forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextEncoder_ext.h
More file actions
50 lines (40 loc) · 1.4 KB
/
textEncoder_ext.h
File metadata and controls
50 lines (40 loc) · 1.4 KB
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
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file textEncoder_ext.h
* @author rdb
* @date 2018-09-29
*/
#ifndef TEXTENCODER_EXT_H
#define TEXTENCODER_EXT_H
#include "dtoolbase.h"
#ifdef HAVE_PYTHON
#include "extension.h"
#include "textEncoder.h"
#include "py_panda.h"
/**
* This class defines the extension methods for TextEncoder, which are called
* instead of any C++ methods with the same prototype.
*/
template<>
class Extension<TextEncoder> : public ExtensionBase<TextEncoder> {
public:
void set_text(PyObject *text);
void set_text(PyObject *text, TextEncoder::Encoding encoding);
PyObject *get_text() const;
PyObject *get_text(TextEncoder::Encoding encoding) const;
void append_text(PyObject *text);
static PyObject *encode_wchar(char32_t ch, TextEncoder::Encoding encoding);
INLINE PyObject *encode_wtext(const std::wstring &wtext) const;
static PyObject *encode_wtext(const std::wstring &wtext, TextEncoder::Encoding encoding);
INLINE PyObject *decode_text(PyObject *text) const;
static PyObject *decode_text(PyObject *text, TextEncoder::Encoding encoding);
};
#include "textEncoder_ext.I"
#endif // HAVE_PYTHON
#endif // TEXTENCODER_EXT_H