x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
NXU_string.cpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\NxuStream2\source\NXU_string.cpp
旋转
特效
属性
历史版本
#include
#include
#include
#include
#include
#ifdef _MSC_VER #pragma warning(disable:4996) // Disabling stupid .NET deprecated warning. #endif #include "NXU_string.h" #include "NXU_helper.h" NXU_errorReport *gErrorReport = 0; namespace NXU { bool gUseClothActiveState=false; bool gUseSoftBodyActiveState=false; bool gSaveBigEndian=false; bool gProcessorBigEndian=false; struct StringList { StringList *mNextString; const char *mString; }; static StringList *gRoot = 0; static int gStringCount = 0; static int gStringMem = 0; struct InstanceList { InstanceList *mNextInstance; const char *mName; void *mInstance; }; static InstanceList *gInstanceRoot = 0; static int gInstanceCount = 0; static int gInstanceMem = 0; const char *getGlobalString(const char *str) { if (str == 0) { return 0; } int l = (int)strlen(str); if (l == 0) { return 0; } if (gRoot) { StringList *s = gRoot; while (s) { if (strcmp(s->mString, str) == 0) { return s->mString; } s = s->mNextString; } } l = l + 1+sizeof(StringList); gStringCount++; gStringMem += l; char *ret = new char[l]; StringList *s = (StringList*)ret; s++; ret = (char*)s; s--; s->mNextString = gRoot; s->mString = ret; gRoot = s; strcpy(ret, str); return ret; } void releaseGlobalStrings(void) { StringList *s = gRoot; while (s) { StringList *next = s->mNextString; char *c = (char*)s; delete c; s = next; } gRoot = 0; gStringCount = 0; gStringMem = 0; } void *findInstance(const char *str) // find a previously created instance of an entity by name. null if not found. { void *ret = 0; InstanceList *s = gInstanceRoot; while (s) { if (strcmp(s->mName, str) == 0) { ret = s->mInstance; break; } s = s->mNextInstance; } return ret; } void setInstance(const char *str, void *instance) // set a named association with this instance. { void *mem = findInstance(str); assert(mem == 0); // this should never happen? if (mem == 0) { str = getGlobalString(str); // convert it to a global string. gInstanceCount++; gInstanceMem += sizeof(InstanceList); InstanceList *il = new InstanceList; il->mNextInstance = gInstanceRoot; gInstanceRoot = il; il->mName = str; il->mInstance = instance; } } void releaseGlobalInstances(void) // release the global instance table { InstanceList *s = gInstanceRoot; while (s) { InstanceList *next = s->mNextInstance; char *c = (char*)s; delete c; s = next; } gInstanceRoot = 0; gInstanceCount = 0; gInstanceMem = 0; } void reportError(const char *fmt, ... ) { if ( gErrorReport ) { char wbuff[2048]; va_list ap; va_start(ap, fmt); vsprintf(wbuff, fmt, ap); va_end(ap); gErrorReport->NXU_errorMessage(true,wbuff); } } void reportWarning(const char *fmt, ... ) { if ( gErrorReport ) { char wbuff[2048]; va_list ap; va_start(ap, fmt); vsprintf(wbuff, fmt, ap); va_end(ap); gErrorReport->NXU_errorMessage(false,wbuff); } } };
NXU_string.cpp
网页地址
文件地址
上一页
17/21
下一页
下载
( 3 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.