mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Convert custom HeadSpin integer types to standard types from stdint.h
This commit is contained in:
@ -78,7 +78,7 @@ hsStringTable::Node* hsStringTable::Find(const char* str)
|
||||
// at the first point where a unique path can not be determined
|
||||
// char* str is filled out with the matching path
|
||||
//
|
||||
hsStringTable::Node* hsStringTable::FindPartial(char* str, Int32 len) const
|
||||
hsStringTable::Node* hsStringTable::FindPartial(char* str, int32_t len) const
|
||||
{
|
||||
return (str && *str) ? FindPartialRecur(root.kid, str, len) : nil;
|
||||
}
|
||||
@ -135,7 +135,7 @@ hsStringTable::Node* hsStringTable::FindRecur(Node* root, const char* str, hsBoo
|
||||
//
|
||||
// Recursively find the unique partial match
|
||||
//
|
||||
hsStringTable::Node* hsStringTable::FindPartialRecur(Node* root, char* str, Int32 len) const
|
||||
hsStringTable::Node* hsStringTable::FindPartialRecur(Node* root, char* str, int32_t len) const
|
||||
{
|
||||
if (!root || !str)
|
||||
{
|
||||
@ -169,7 +169,7 @@ hsStringTable::Node* hsStringTable::FindPartialRecur(Node* root, char* str, Int3
|
||||
//
|
||||
// Follow the current node as far as possible towards a unique leaf
|
||||
//
|
||||
hsStringTable::Node* hsStringTable::FindLeafRecur(Node* root, char* str, Int32 len) const
|
||||
hsStringTable::Node* hsStringTable::FindLeafRecur(Node* root, char* str, int32_t len) const
|
||||
{
|
||||
if (root->data || !root->kid || root->kid->sib)
|
||||
{
|
||||
|
@ -66,16 +66,16 @@ public:
|
||||
~hsStringTable();
|
||||
void Reset();
|
||||
Node* Find(const char* str);
|
||||
Node* FindPartial(char* str, Int32 len=0) const;
|
||||
Node* FindPartial(char* str, int32_t len=0) const;
|
||||
void Register(const char* str, void* data);
|
||||
|
||||
typedef hsBool (hsStringTableCallback)(Node*);
|
||||
hsBool Iterate(hsStringTableCallback* callback, Node* fromNode=nil);
|
||||
private:
|
||||
Node* FindRecur(Node* root, const char* str, hsBool createIfNeeded=false);
|
||||
Node* FindPartialRecur(Node* root, char* str, Int32 len) const;
|
||||
Node* FindPartialRecur(Node* root, char* str, int32_t len) const;
|
||||
Node* AddRecur(Node* root, const char* str);
|
||||
Node* FindLeafRecur(Node* root, char* str, Int32 len) const;
|
||||
Node* FindLeafRecur(Node* root, char* str, int32_t len) const;
|
||||
void RemoveNode(Node* root);
|
||||
hsBool IterateRecur(Node* root, hsStringTableCallback* callback);
|
||||
|
||||
|
@ -48,21 +48,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
template < class T >
|
||||
class plDataContainerT
|
||||
{
|
||||
typedef std::map<UInt32,T*> Items;
|
||||
typedef std::map<uint32_t,T*> Items;
|
||||
Items fItems;
|
||||
UInt32 fNextKey;
|
||||
uint32_t fNextKey;
|
||||
public:
|
||||
plDataContainerT()
|
||||
: fNextKey( 1 )
|
||||
{}
|
||||
UInt32 Add( T* data )
|
||||
uint32_t Add( T* data )
|
||||
{
|
||||
UInt32 key = fNextKey;
|
||||
uint32_t key = fNextKey;
|
||||
fItems[ key ] = data;
|
||||
fNextKey++;
|
||||
return key;
|
||||
}
|
||||
bool Get( UInt32 key, T*& outItem, bool remove=true )
|
||||
bool Get( uint32_t key, T*& outItem, bool remove=true )
|
||||
{
|
||||
outItem = nil;
|
||||
Items::iterator ii = fItems.find( key );
|
||||
|
@ -174,7 +174,7 @@ std::string plKeysAndValues::GetValue(const std::string & key, const std::string
|
||||
return defval;
|
||||
}
|
||||
|
||||
UInt32 plKeysAndValues::GetValue(const std::string & key, UInt32 defval, bool * outFound) const
|
||||
uint32_t plKeysAndValues::GetValue(const std::string & key, uint32_t defval, bool * outFound) const
|
||||
{
|
||||
char buf[20];
|
||||
sprintf(buf, "%ul", defval);
|
||||
@ -229,17 +229,17 @@ bool plKeysAndValues::GetValueIterators(const xtl::istring & key, Values::const_
|
||||
|
||||
void plKeysAndValues::Read(hsStream * s)
|
||||
{
|
||||
UInt16 nkeys;
|
||||
uint16_t nkeys;
|
||||
s->ReadLE(&nkeys);
|
||||
for (int ki=0; ki<nkeys; ki++)
|
||||
{
|
||||
UInt16 strlen;
|
||||
uint16_t strlen;
|
||||
s->ReadLE(&strlen);
|
||||
std::string key;
|
||||
key.assign(strlen+1,'\0');
|
||||
s->Read(strlen,(void*)key.data());
|
||||
key.resize(strlen);
|
||||
UInt16 nvalues;
|
||||
uint16_t nvalues;
|
||||
s->ReadLE(&nvalues);
|
||||
for (int vi=0; vi<nvalues; vi++)
|
||||
{
|
||||
@ -257,24 +257,24 @@ void plKeysAndValues::Read(hsStream * s)
|
||||
void plKeysAndValues::Write(hsStream * s)
|
||||
{
|
||||
// write nkeys
|
||||
s->WriteLE((UInt16)fKeys.size());
|
||||
s->WriteLE((uint16_t)fKeys.size());
|
||||
// iterate through keys
|
||||
Keys::const_iterator ki,ke;
|
||||
GetKeyIterators(ki,ke);
|
||||
for (;ki!=ke;++ki)
|
||||
{
|
||||
// write key string
|
||||
s->WriteLE((UInt16)ki->first.size());
|
||||
s->WriteLE((uint16_t)ki->first.size());
|
||||
s->Write(ki->first.size(),ki->first.c_str());
|
||||
// write nvalues for this key
|
||||
s->WriteLE((UInt16)ki->second.size());
|
||||
s->WriteLE((uint16_t)ki->second.size());
|
||||
// iterate through values for this key
|
||||
Values::const_iterator vi,ve;
|
||||
GetValueIterators(ki->first,vi,ve);
|
||||
for (;vi!=ve;++vi)
|
||||
{
|
||||
// write value string
|
||||
s->WriteLE((UInt16)vi->size());
|
||||
s->WriteLE((uint16_t)vi->size());
|
||||
s->Write(vi->size(),vi->c_str());
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
bool SetValue(const std::string & key, double value);
|
||||
// get single value
|
||||
std::string GetValue(const std::string & key, const std::string & defval="", bool * outFound=nil) const;
|
||||
UInt32 GetValue(const std::string & key, UInt32 defval, bool * outFound=nil) const;
|
||||
uint32_t GetValue(const std::string & key, uint32_t defval, bool * outFound=nil) const;
|
||||
int GetValue(const std::string & key, int defval, bool * outFound=nil) const;
|
||||
double GetValue(const std::string & key, double defval, bool * outFound=nil) const;
|
||||
std::vector<std::string> GetAllValues(const std::string & key);
|
||||
@ -108,7 +108,7 @@ public:
|
||||
void Read(hsStream * s);
|
||||
void Write(hsStream * s);
|
||||
// TODO:
|
||||
UInt32 GetStreamSize() { return 0;}
|
||||
uint32_t GetStreamSize() { return 0;}
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user