📄 warlngtext.cpp
字号:
#include "StdAfx.h"#include "WarLngText.h" // class implemented#ifndef WAR_FNMATCH_H# include "WarFnmatch.h"#endif#ifndef WAR_AUTO_LOCK_H# include "WarAutoLock.h"#endif#define AUTO_LOCK WarAutoLock my_lock(mLock);/////////////////////////////// PUBLIC /////////////////////////////////////////============================= LIFECYCLE ====================================WarLngText::WarLngText(size_t numStrings): mStrings(numStrings, NULL),mStrNames(NULL), mDefaultStrings(NULL){}// WarLngTextWarLngText::WarLngText(war_ccstr_t name, war_ccstr_t lngCode): mName(name), mLngCode(lngCode ? lngCode : "en-us"),mStrNames(NULL), mDefaultStrings(NULL){}WarLngText::~WarLngText(){}// ~WarLngText//============================= OPERATORS ====================================bool WarLngText::operator < (const WarLngText& from) const{ if (stricmp(mName.c_str(), from.mName.c_str()) < 0) return true; if (WarFnmatch(mLngCode.c_str(), from.mLngCode.c_str(), FNM_CASEFOLD)) return false; if (stricmp(mLngCode.c_str(), from.mLngCode.c_str()) < 0) return true; return false;}bool WarLngText::operator == (const WarLngText& from) const{ if (stricmp(mName.c_str(), from.mName.c_str()) == 0) return true; if (WarFnmatch(mLngCode.c_str(), from.mLngCode.c_str(), FNM_CASEFOLD)) return false; return false;}//============================= OPERATIONS ===================================WarLngText *WarLngText::CreateInstance() throw(WarException){ WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL);}//============================= CALLBACK ===================================//============================= ACCESS ===================================war_ccstr_t WarLngText::GetText(unsigned textIndex) constthrow(WarException){ if (textIndex >= mStrings.size()) WarThrow(WarError(WAR_ERR_OUT_OF_RANGE), NULL); war_ccstr_t p = mStrings[textIndex]; if (NULL == p) p = mDefaultStrings[textIndex]; return p;}//============================= INQUIRY ===================================const std::string& WarLngText::GetName() const{ return mName;}const std::string& WarLngText::GetCharset() const{ return mCharset;}const std::string& WarLngText::GetLngCode() const{ return mLngCode;}/////////////////////////////// PROTECTED ////////////////////////////////////////////////////////////////// PRIVATE ///////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -