📄 warlngtextengine.cpp
字号:
#include "StdAfx.h"#include "WarLngTextEngine.h" // class implemented#ifndef WAR_AUTO_LOCK_H# include "WarAutoLock.h"#endif#define AUTO_LOCK WarAutoLock my_lock(mLock);/////////////////////////////// PUBLIC /////////////////////////////////////////============================= LIFECYCLE ====================================WarLngTextEngine::WarLngTextEngine(){ assert(NULL == mpEngine); mpEngine = this;}// WarLngTextEngineWarLngTextEngine::~WarLngTextEngine(){ assert(mpEngine == this); mpEngine = NULL;}// ~WarLngTextEngine//============================= OPERATORS ====================================//============================= OPERATIONS ===================================void WarLngTextEngine::AddLngHandler(war_lngtext_ptr_t& lngPtr){ AUTO_LOCK; mLngHandlers.insert(lngPtr);}war_lngtext_ptr_t WarLngTextEngine::GetLngText(war_ccstr_t name, war_ccstr_t lngCode) throw(WarException){ AUTO_LOCK; war_lngtext_ptr_t key = new WarLngText(name, lngCode); lngtext_set_t::iterator P = mLngHandlers.find(key); if (P == mLngHandlers.end()) { if (NULL != lngCode) { if (strlen(lngCode) > 2) { // Try another variant of the same language char code_buf[4]; code_buf[0] = lngCode[0]; code_buf[1] = lngCode[1]; code_buf[2] = '*'; code_buf[3] = 0; key = new WarLngText(name, code_buf); P = mLngHandlers.find(key); } } if (P == mLngHandlers.end()) { // Try default implementation key = new WarLngText(name, NULL); P = mLngHandlers.find(key); } if (P == mLngHandlers.end()) WarThrow(WarError(WAR_ERR_OBJECT_NOT_FOUND), NULL); } return *P;}//============================= CALLBACK ===================================//============================= ACCESS ===================================WarLngTextEngine& WarLngTextEngine::GetEngine(){ assert(NULL != mpEngine); return *mpEngine;}//============================= INQUIRY ===================================/////////////////////////////// PROTECTED ////////////////////////////////////////////////////////////////// PRIVATE ///////////////////////////////////WarLngTextEngine * WarLngTextEngine::mpEngine;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -