mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-21 12:49:10 +00:00
Convert SDL (mostly) to plStrings
This commit is contained in:
@ -107,10 +107,10 @@ namespace plSDL
|
||||
class plStateVarNotificationInfo
|
||||
{
|
||||
private:
|
||||
std::string fHintString;
|
||||
plString fHintString;
|
||||
public:
|
||||
void SetHintString(const char* c) { fHintString=c; }
|
||||
const char* GetHintString() const { return fHintString.c_str(); }
|
||||
void SetHintString(const plString& c) { fHintString=c; }
|
||||
plString GetHintString() const { return fHintString; }
|
||||
|
||||
void Read(hsStream* s, uint32_t readOptions);
|
||||
void Write(hsStream* s, uint32_t writeOptions) const;
|
||||
@ -137,8 +137,8 @@ public:
|
||||
plStateVariable() : fFlags(0) {}
|
||||
virtual ~plStateVariable() {}
|
||||
|
||||
const char* GetName() const { return GetVarDescriptor()->GetName(); }
|
||||
bool IsNamed(const char* n) const { return (n && !stricmp(GetName(), n)); }
|
||||
plString GetName() const { return GetVarDescriptor()->GetName(); }
|
||||
bool IsNamed(const char* n) const { return (n && !GetName().CompareI(n)); }
|
||||
virtual int GetCount() const = 0;
|
||||
|
||||
// conversion ops
|
||||
@ -193,7 +193,7 @@ public:
|
||||
int RemoveNotificationKey(plKey k); // returns number of keys left after removal
|
||||
int RemoveNotificationKeys(KeyList keys); // returns number of keys left after removal
|
||||
|
||||
void SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar, const char* sdlName);
|
||||
void SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar, const plString& sdlName);
|
||||
|
||||
bool GetValue(float* i) const;
|
||||
bool SetValue(float i);
|
||||
@ -266,10 +266,10 @@ public:
|
||||
void TimeStamp( const plUnifiedTime & ut=plUnifiedTime::GetCurrentTime() );
|
||||
void CopyFrom(plVarDescriptor* v);
|
||||
void CopyData(const plSimpleStateVariable* other, uint32_t writeOptions=0);
|
||||
bool SetFromString(const char* value, int idx, bool timeStampNow); // set value from string, type. return false on err
|
||||
char* GetAsString(int idx) const;
|
||||
bool SetFromString(const plString& value, int idx, bool timeStampNow); // set value from string, type. return false on err
|
||||
plString GetAsString(int idx) const;
|
||||
bool ConvertTo(plSimpleVarDescriptor* toVar, bool force=false); // return false on err
|
||||
void Alloc(int cnt=-1 /* -1 means don't change count */); // alloc memory after setting type
|
||||
void Alloc(int cnt=-1 /* -1 means don't change count */); // alloc memory after setting type
|
||||
void Reset();
|
||||
|
||||
// setters
|
||||
@ -293,7 +293,7 @@ public:
|
||||
// getters
|
||||
bool Get(int* value, int idx=0) const;
|
||||
bool Get(short* value, int idx=0) const;
|
||||
bool Get(uint8_t* value, int idx=0) const; // returns uint8_t or uint8_tVector
|
||||
bool Get(uint8_t* value, int idx=0) const; // returns uint8_t or uint8_tVector
|
||||
bool Get(float* value, int idx=0) const; // returns float or floatVector
|
||||
bool Get(double* value, int idx=0) const; // returns double or doubleVector
|
||||
bool Get(bool* value, int idx=0) const;
|
||||
@ -315,7 +315,7 @@ public:
|
||||
void AddStateChangeNotification(plStateChangeNotifier& n);
|
||||
void RemoveStateChangeNotification(plKey notificationObj); // remove all with this key
|
||||
void RemoveStateChangeNotification(plStateChangeNotifier n); // remove ones which match
|
||||
void NotifyStateChange(const plSimpleStateVariable* other, const char* sdlName); // send notification msg if necessary, internal use
|
||||
void NotifyStateChange(const plSimpleStateVariable* other, const plString& sdlName); // send notification msg if necessary, internal use
|
||||
|
||||
void DumpToObjectDebugger(bool dirtyOnly, int level) const;
|
||||
void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const;
|
||||
@ -407,18 +407,18 @@ protected:
|
||||
plUoid fAssocObject; // optional
|
||||
VarsList fVarsList; // list of variables
|
||||
VarsList fSDVarsList; // list of nested data records
|
||||
uint32_t fFlags;
|
||||
uint32_t fFlags;
|
||||
static const uint8_t kIOVersion; // I/O Version
|
||||
|
||||
void IDeleteVarsList(VarsList& vars);
|
||||
void IInitDescriptor(const char* name, int version); // or plSDL::kLatestVersion
|
||||
void IInitDescriptor(const plString& name, int version); // or plSDL::kLatestVersion
|
||||
void IInitDescriptor(const plStateDescriptor* sd);
|
||||
|
||||
void IReadHeader(hsStream* s);
|
||||
void IWriteHeader(hsStream* s) const;
|
||||
bool IConvertVar(plSimpleStateVariable* fromVar, plSimpleStateVariable* toVar, bool force);
|
||||
|
||||
plStateVariable* IFindVar(const VarsList& vars, const char* name) const;
|
||||
plStateVariable* IFindVar(const VarsList& vars, const plString& name) const;
|
||||
int IGetNumUsedVars(const VarsList& vars) const;
|
||||
int IGetUsedVars(const VarsList& varsOut, VarsList *varsIn) const; // build a list of vars that have data
|
||||
bool IHasUsedVars(const VarsList& vars) const;
|
||||
@ -430,7 +430,7 @@ public:
|
||||
CLASSNAME_REGISTER( plStateDataRecord );
|
||||
GETINTERFACE_ANY( plStateDataRecord, plCreatable);
|
||||
|
||||
plStateDataRecord(const char* sdName, int version=plSDL::kLatestVersion);
|
||||
plStateDataRecord(const plString& sdName, int version=plSDL::kLatestVersion);
|
||||
plStateDataRecord(plStateDescriptor* sd);
|
||||
plStateDataRecord(const plStateDataRecord &other, uint32_t writeOptions=0 ):fFlags(0) { CopyFrom(other, writeOptions); }
|
||||
plStateDataRecord():fFlags(0) {}
|
||||
@ -442,8 +442,8 @@ public:
|
||||
uint32_t GetFlags() const { return fFlags; }
|
||||
void SetFlags(uint32_t f) { fFlags =f; }
|
||||
|
||||
plSimpleStateVariable* FindVar(const char* name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); }
|
||||
plSDStateVariable* FindSDVar(const char* name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); }
|
||||
plSimpleStateVariable* FindVar(const plString& name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); }
|
||||
plSDStateVariable* FindSDVar(const plString& name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); }
|
||||
|
||||
plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); return *this; }
|
||||
void CopyFrom(const plStateDataRecord& other, uint32_t writeOptions=0);
|
||||
@ -479,7 +479,7 @@ public:
|
||||
bool HasDirtySDVars() const { return IHasDirtyVars(fSDVarsList); }
|
||||
|
||||
const plStateDescriptor* GetDescriptor() const { return fDescriptor; }
|
||||
void SetDescriptor(const char* sdName, int version);
|
||||
void SetDescriptor(const plString& sdName, int version);
|
||||
|
||||
plNetMsgSDLState* PrepNetMsg(float timeConvert, uint32_t writeOptions) const; // create/prep a net msg with this data
|
||||
|
||||
@ -498,7 +498,7 @@ public:
|
||||
bool Read(hsStream* s, float timeConvert, uint32_t readOptions=0);
|
||||
void Write(hsStream* s, float timeConvert, uint32_t writeOptions=0) const;
|
||||
|
||||
static bool ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid=nil);
|
||||
static bool ReadStreamHeader(hsStream* s, plString* name, int* version, plUoid* objUoid=nil);
|
||||
void WriteStreamHeader(hsStream* s, plUoid* objUoid=nil) const;
|
||||
};
|
||||
|
||||
@ -543,7 +543,7 @@ public:
|
||||
~plSDLMgr();
|
||||
|
||||
static plSDLMgr* GetInstance();
|
||||
plStateDescriptor* FindDescriptor(const char* name, int version, const plSDL::DescriptorList * dl=nil) const; // version or kLatestVersion
|
||||
plStateDescriptor* FindDescriptor(const plString& name, int version, const plSDL::DescriptorList * dl=nil) const; // version or kLatestVersion
|
||||
|
||||
const plSDL::DescriptorList * GetDescriptors( void ) const { return &fDescriptors;}
|
||||
|
||||
|
Reference in New Issue
Block a user