本文整理汇总了C++中LString类的典型用法代码示例。如果您正苦于以下问题:C++ LString类的具体用法?C++ LString怎么用?C++ LString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRendererByType
RendererPtr Object::getRendererByType(const LString &type_name)
{
rendtab_t::const_iterator i = m_rendtab.begin();
rendtab_t::const_iterator e = m_rendtab.end();
for (; i!=e; ++i) {
if ( type_name.equals(i->second->getTypeName()) )
return i->second;
}
return RendererPtr();
}
示例2: PreCacheC
void clResourcesManager::PreCacheC( const LString& Param )
{
if ( Param.empty() )
{
Env->Console->DisplayInfoTip( "Usage: PRECACHE <shader or texture file name>" );
return;
}
Env->Console->Display( "Precaching shader... " + Param );
Env->Resources->LoadShader( Param );
}
示例3: ai
void LScrVector4D::setStrValue(const LString &val)
{
Vector4D vec;
if (!Vector4D::fromStringS(val, vec)) {
LString msg = LString::format("cannot convert \"%s\" to vector", val.c_str());
MB_THROW(qlib::RuntimeException, msg);
return;
}
for (int i=1; i<=4; ++i)
ai(i) = vec.ai(i);
}
示例4: ConvertName
/**
This will convert requested filename with full path into a single file name
e.g. c:\\data\\textures\\texture1.tga
c~_data_textures_texture1.tga
**/
LString clResourcesManager::ConvertName( const LString& FileName )
{
LString ConvName;
for ( size_t i = 0; i < FileName.length(); ++i )
{
switch ( FileName[i] )
{
case '\\':
case '/':
{
ConvName.push_back( '_' );
continue;
}
case ':':
{
ConvName.push_back( '~' );
continue;
}
case ' ':
{
ConvName.push_back( '#' );
continue;
}
}
ConvName.push_back( FileName[i] );
}
return ConvName;
}
示例5: srcpath
void ExpatInStream::parse()
{
// check base URI
fs::path srcpath(getURI());
#if (BOOST_FILESYSTEM_VERSION==2)
LString base_dir = srcpath.parent_path().directory_string();
#else
LString base_dir = srcpath.parent_path().string();
#endif
if (!base_dir.isEmpty())
setBaseURI(base_dir);
//detail::AbstFIOImpl *pimpl =
//dynamic_cast<detail::AbstFIOImpl *>(getImpl().get());
//if (pimpl!=NULL) {
//MB_DPRINTLN("File: base URI %s", pimpl->getDirName().c_str());
//setBaseURI((pimpl->getDirName())+LString(MB_PATH_SEPARATOR));
//}
char buf[bufsize];
bool done=false;
do {
int len = super_t::read(buf, 0, sizeof(buf));
done = len < sizeof(buf);
if (XML_Parse(getParser(), buf, len, done) == XML_STATUS_ERROR) {
LString msg =
LString::format("%s at line %d\n",
XML_ErrorString(XML_GetErrorCode(getParser())),
getLineNo());
MB_DPRINTLN("ExpatInStream> error: %s", msg.c_str());
MB_THROW(qlib::IOException, msg);
}
else if (getError()) {
MB_DPRINTLN("ExpatInStream> error: %s", getErrorMsg().c_str());
MB_THROW(qlib::IOException, getErrorMsg());
}
} while (!done);
}
示例6: startTxn
void UndoManager::startTxn(const LString &desc)
{
if (isDisabled()) return; // ignore nested txn !!
if (m_pPendInfo!=NULL) {
m_nTxnNestLevel ++;
return;
}
m_pPendInfo = MB_NEW UndoInfo();
m_pPendInfo->setDesc(desc);
MB_DPRINTLN("===== START UNDO TXN (%s) =====", desc.c_str());
}
示例7: indexOf
int LString::indexOf(const LString &str, int start) const {
if (str.length() > this->length()) return -1;
if (str.length() == 1) return indexOf(str[0], start);
ConstIterator si = str.cbegin();
int indexCounter = start;
int index = 0;
for (ConstIterator i = at(start); i != cend(); i++, indexCounter++) {
if (*si == *i) {
if (si == str.cbegin()) {
index = indexCounter;
}
si++;
if (si == str.cend()) {
return index;
}
continue;
}
si = str.cbegin();
}
return -1;
}
示例8: setSGByName
void CrystalInfo::setSGByName(const LString &name)
{
SymOpDB *pdb = SymOpDB::getInstance();
int sgid = pdb->getSgIDByCName(name);
if (sgid<1) {
sgid = pdb->getSgIDByName(name);
if (sgid<1) {
LString msg = LString::format("Invalid s.g. name <%s>", name.c_str());
MB_THROW (qlib::RuntimeException, msg);
return;
}
}
setSG(sgid);
}
示例9: guard
void clLocalizer::SetLocale( const LString& LocaleName )
{
guard( "%s", LocaleName.c_str() );
ClearLocalization();
FLocaleName = LocaleName;
const LString FileName( FLocalePath + "/Localizer-" + LocaleName + ".txt" );
if ( Env->FileSystem->FileExists( FileName ) )
{
Env->Logger->LogP( L_NOTICE, "Reading locale from %s", FileName.c_str() );
iIStream* Stream = Env->FileSystem->CreateFileReader( FileName );
while ( !Stream->Eof() )
{
LString Line = Stream->ReadLine();
size_t SepPos = Line.find( "~" );
FATAL( SepPos == Line.npos, "Invalid locale translation file format: missing ~" );
LString Text( Line.substr( 0, SepPos ) );
LString Translation( Line.substr( SepPos + 1, Line.length() - SepPos - 1 ) );
FTranslations[ Text ] = Translation;
}
delete( Stream );
}
else
{
Env->Logger->LogP( L_NOTICE, "Locale %s not found", FileName.c_str() );
}
this->SendAsync( L_EVENT_LOCALE_CHANGED, LEventArgs(), false );
unguard();
}
示例10: InitializeScript
LString clConsole::ExecuteScriptCode( const LString& ScriptCode, bool DisplayResult )
{
// delayed initilaization :
if ( !FScriptCompiler->IsInitialized() )
{
InitializeScript();
}
LString Code = FScriptCompiler->CompileStatement( ScriptCode );
if ( !Code.empty() )
{
std::vector<LString> CodeLines;
LStr::LineToMultiline( Code, CodeLines );
LString Result = Env->Linker->ExecuteCode( CodeLines );
if ( DisplayResult )
{
Display( "Result = " + Result );
}
FSendCommandResult = Result;
}
else
{
if ( DisplayResult )
{
Display( "Error while compiling statement" );
}
FSendCommandResult.assign( "" );
}
return FSendCommandResult;
}
示例11: LOG_DPRINTLN
RendererPtr Object::createRenderer(const LString &type_name)
{
RendererFactory *pRF = RendererFactory::getInstance();
RendererPtr pRend = pRF->create(type_name);
if (!registerRendererImpl(pRend)) {
// error !! cannot register renderer.
LOG_DPRINTLN("ERROR !! cannot register renderer");
LString msg = LString::format("Cannot register renderer %s", type_name.c_str());
MB_THROW(qlib::RuntimeException, msg);
return RendererPtr();
}
MB_DPRINTLN("createRenderer clientObjID=%d OK", (int)pRend->getClientObjID());
return pRend;
}
示例12: LString
//------------------------------------------------------------------------------
int LArguments::parse(int argc, char* argv[]) {
LString opt;
int find;
int ret;
for(int num = 1; num < argc; num++) {
opt = LString(argv[num]);
if(opt.find("--") == 0) {
if((find = opt.find("=")) != (int)string::npos) {
if((ret = parseInternalOptionWithParamater(opt.substr(0, find), opt.substr(find + 1))) != L_OK) {
return ret;
}
}
else {
if((ret = parseInternalOption(opt)) != L_OK) {
return ret;
}
}
}
else if(opt.find("-") == 0) {
if((find = opt.find("=")) != (int)string::npos) {
if((ret = parseInternalOptionWithParamater(opt.substr(0, find), opt.substr(find + 1))) != L_OK) {
return ret;
}
}
else {
if((ret = parseInternalOption(opt)) != L_OK) {
return ret;
}
}
}
else {
if((ret = parseInternalArgument(opt)) != L_OK) {
return ret;
}
}
}
return L_OK;
}
示例13: sysNameToID
int CrystalInfo::sysNameToID(const LString &nm)
{
if (nm.equalsIgnoreCase("TRICLINIC"))
return TRICLINIC;
if (nm.equalsIgnoreCase("MONOCLINIC"))
return MONOCLINIC;
if (nm.equalsIgnoreCase("ORTHORHOMBIC"))
return ORTHORHOMBIC;
if (nm.equalsIgnoreCase("TETRAGONAL"))
return TETRAGONAL;
if (nm.equalsIgnoreCase("TRIGONAL"))
return TRIGONAL;
if (nm.equalsIgnoreCase("RHOMBOHEDRAL"))
return TRIGONAL;
if (nm.equalsIgnoreCase("HEXAGONAL"))
return HEXAGONAL;
if (nm.equalsIgnoreCase("CUBIC"))
return CUBIC;
MB_DPRINTLN("XtalInfo: invalid xtal sysname <%s>", nm.c_str());
return -1; // invalid sysname
}
示例14: getService
qlib::uid_t XmlRpcMgr::getService(const LString &clsname)
{
ReoGetService evt;
evt.m_clsname = clsname;
evt.m_pRval = NULL;
m_pQue->putWait(&evt);
MB_DPRINTLN("XMLRPC> getService: svrthr clsname=%s, result=%d!!",
clsname.c_str(), evt.m_bOK);
if (!evt.m_bOK || evt.m_pRval==NULL) {
throw ( xmlrpc_c::fault(evt.m_errmsg.c_str(), xmlrpc_c::fault::CODE_UNSPECIFIED) );
return qlib::invalid_uid;
}
return registerObj(static_cast<qlib::LScriptable*>(evt.m_pRval));
}
示例15: unescape_url
/** Reduce any %xx escape sequences to the characters they represent. **/
void unescape_url(LString& url)
{
register int i,j;
for(i=0,j=0; j<url.size(); ++i,++j)
{
if((url.at(i) = url[j]) == '%')
{
url.at(i) = x2c(url.at(j+1), url.at(j+2));
j+= 2 ;
}
}
if (i < url.size())
url.at(i) = '\0' ;
}