forked from carbonengine/db
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringStore.cpp
More file actions
57 lines (42 loc) · 767 Bytes
/
Copy pathStringStore.cpp
File metadata and controls
57 lines (42 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright © 2014 CCP ehf.
#include "stdafx.h"
#include "StringStore.h"
template <>
bool InternalStoreElement<char, true>::ToPython()
{
_ASSERT( !mPython );
PyObject* p = PyUnicode_FromStringAndSize( mData, mElements );
if(!p)
{
return false;
}
mPython = true;
mObject = p;
return true;
}
template <>
bool InternalStoreElement<char, false>::ToPython()
{
_ASSERT( !mPython );
PyObject* p = PyBytes_FromStringAndSize( mData, mElements );
if(!p)
{
return false;
}
mPython = true;
mObject = p;
return true;
}
template <>
bool InternalStoreElement<wchar_t, true>::ToPython()
{
_ASSERT( !mPython );
PyObject* p = PyUnicode_FromWideChar( mData, mElements );
if(!p)
{
return false;
}
mPython = true;
mObject = p;
return true;
}