forked from zrax/pycdc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyc_string.h
37 lines (27 loc) · 1.01 KB
/
pyc_string.h
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
#ifndef _PYC_STRING_H
#define _PYC_STRING_H
#include "pyc_object.h"
#include "data.h"
#include <cstdio>
#include <string>
class PycString : public PycObject {
public:
PycString(int type = TYPE_STRING)
: PycObject(type) { }
bool isEqual(PycRef<PycObject> obj) const override;
bool isEqual(const std::string& str) const { return m_value == str; }
bool startsWith(const std::string& str) const
{
return m_value.substr(0, str.size()) == str;
}
void load(class PycData* stream, class PycModule* mod, int currentDepth, int maxDepth) override;
int length() const { return (int)m_value.size(); }
const char* value() const { return m_value.c_str(); }
const std::string &strValue() const { return m_value; }
void setValue(std::string str) { m_value = std::move(str); }
private:
std::string m_value;
};
void OutputString(PycRef<PycString> str, char prefix = 0, bool triple = false,
FILE* F = pyc_output, const char* parent_f_string_quote = nullptr);
#endif