Files
Pyarmor-Static-Unpack-1shot/pycdc/pyc_string.h
2025-09-13 14:39:22 +08:00

42 lines
1.1 KiB
C++

#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) 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); }
void print(std::ostream& stream, class PycModule* mod, bool triple = false,
const char* parent_f_string_quote = nullptr);
void dasPrintAndDecrypt(std::ostream& stream, class PycModule* mod,
bool triple = false,
const char* parent_f_string_quote = nullptr);
private:
std::string m_value;
};
#endif