当前位置: 首页>>代码示例>>C++>>正文


C++ CString::Length方法代码示例

本文整理汇总了C++中CString::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Length方法的具体用法?C++ CString::Length怎么用?C++ CString::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CString的用法示例。


在下文中一共展示了CString::Length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WalkTree

CDataNode* 
CDataNode::Structure( const CString& sequence ,
                      char seperator          )
{GUCEF_TRACE;

    // walk the tree
    CString buildseg;
    TDataNodeVector walkResults = WalkTree( sequence  ,
                                            seperator ,
                                            buildseg  );
                 
    // do we need to add nodes ?
    if ( 0 < buildseg.Length() )
    {
        CDataNode* parentNode = this;
        if ( !walkResults.empty() )
            parentNode = *walkResults.begin(); 
        
        CDataNode child;
        CString name;
        while ( buildseg.Length() )
        {
            name = buildseg.SubstrToChar( seperator, true );
            child.SetName( name );                        
            buildseg = buildseg.CutChars( name.Length()+1, true );                        
            parentNode = parentNode->AddChild( child );
        }
        return parentNode;
    }
    
    if ( walkResults.empty() )
        return nullptr;
    return *walkResults.begin();        
}                      
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:34,代码来源:CDataNode.cpp

示例2: thisname

CDataNode* 
CDataNode::Search( const CString& query     ,
                   char seperator           ,
                   bool fromcurrent         ,
                   bool treatChildAsCurrent ) const
{GUCEF_TRACE;

    if ( fromcurrent )
    {
        CString thisname( query.SubstrToChar( seperator, true ) );
        if ( thisname == _name )
        {
            CString remnant( query.CutChars( thisname.Length()+1, true ) );
            if ( remnant.Length() > 0 )
            {            
                CString leftover;
                TDataNodeVector results = WalkTree( remnant   ,
                                                    seperator ,
                                                    leftover  );
                if ( 0 == leftover.Length() && !results.empty() )
                {       
                    return *results.begin();
                }                                 
            }
            else
            {   
                // this node is the leaf node we are searching for
                return const_cast< CDataNode* >( this );
            }
        }
        else
        if ( treatChildAsCurrent )
        {
            TDataNodeList::const_iterator i = m_children.begin();
            while ( i != m_children.end()  )
            {
                CDataNode* result = (*i)->Search( query       ,
                                                  seperator   ,
                                                  fromcurrent ,
                                                  false       );                
                if ( nullptr != result )
                    return result;
                ++i;
            }
        }
        return nullptr;                                            
    }
    else
    {
        CString leftover;
        TDataNodeVector results = WalkTree( query     ,
                                            seperator ,
                                            leftover  );
        if ( 0 == leftover.Length() && !results.empty() )
        {       
            return *results.begin();
        }
        return nullptr;
    }                
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:60,代码来源:CDataNode.cpp

示例3:

CString
CIniParser::StripQuotation( const CString& testString )
{GUCEF_TRACE;

    CString resultStr = testString.Trim( true ).Trim( false );
    if ( resultStr.Length() > 1 )
    {
        if ( ( resultStr[ 0 ] == '\"' ) && ( resultStr[ resultStr.Length()-1 ] == '\"' ) )
        {
            return resultStr.SubstrFromRange( 1, resultStr.Length()-1 );
        }
    }
    return resultStr;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:14,代码来源:gucefCORE_CIniParser.cpp

示例4: newChild

CDataNode*
CDataNode::Structure( const CString& nodeName       ,
                      const CString& attribName     ,
                      const CString& attribSequence ,
                      const char seperator          )
{GUCEF_TRACE;

    // Prepare some variables for the first loop iteration
    CDataNode* node = this;
    CString attSeqRemnant = attribSequence;
    CString attValue = attSeqRemnant.SubstrToChar( seperator );
    bool childExists = true;
    CDataNode* childNode = NULL;
    
    do
    {
        // First we check if we can skip the search for a child node
        // This is a minor optimization        
        if ( childExists )
        {
            // See if there already is a node of the given type
            childNode = node->FindChild( nodeName   ,
                                         attribName ,
                                         attValue   );
            if ( childNode == NULL )
            {
                childExists = false;
            }
        }
        
        // Check if we have to create a new node
        if ( childNode == NULL )
        {
            // No such node exists, we will create it
            CDataNode newChild( nodeName );
            newChild.AddAttribute( attribName, attValue );
            childNode = node->AddChild( newChild );
        }
        
        node = childNode;
        
        // Get the next segment
        attSeqRemnant = attSeqRemnant.CutChars( attValue.Length()+1, true );
        attValue = attSeqRemnant.SubstrToChar( seperator );
        
    } while ( attSeqRemnant.Length() > 0 );
    
    return childNode;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:49,代码来源:CDataNode.cpp

示例5: Evaluate

const CValue* CXMLBoundValueChildNode::Evaluate(_IN SCFXML::CXMLNode& rCurrent) const
{
	if (BoundValueChildNode_pValue) { delete BoundValueChildNode_pValue; BoundValueChildNode_pValue = nullptr; }

	if (rCurrent.Type() == XmlElement)
	{
		CXMLNode* pChild = ((CXMLElement&)rCurrent).ChildFirst();
		while (pChild)
		{
			if (pChild->Name() == m_Name)
			{
				UINT uiCharsParsed = 0;

				CString valueString = pChild->Value() ? pChild->Value()->ToString() : "";

				BoundValueChildNode_pValue = &CValue::Parse(valueString, &uiCharsParsed);

				for (UINT i = uiCharsParsed; i < valueString.Length(); i++)
				{
					if (!CharIsWhiteSpace(valueString[i])) {

						if (BoundValueChildNode_pValue) { delete BoundValueChildNode_pValue; BoundValueChildNode_pValue = nullptr; }

						BoundValueChildNode_pValue = new STRING_RETURN(valueString); 
					}
				}

				return BoundValueChildNode_pValue;
			}
		}
	}

	return nullptr;
}
开发者ID:rjadroncik,项目名称:Shadow-Common-Files,代码行数:34,代码来源:BoundValueChildNode.cpp

示例6: Purge

void CLinkCache::Purge(const CDDEConv* pConv)
{
	typedef CLinksMap::iterator LinksIter;

	CStrArray astrLinks;

	// Format the cache entry prefix for the conversation.
	CString strPrefix = CString::Fmt(TXT("%s|%s!"), pConv->Service().c_str(), pConv->Topic().c_str());
	size_t  nLength   = strPrefix.Length();

	// Find all links for the conversation...
	for (LinksIter it = m_oLinks.begin(); it != m_oLinks.end(); ++it)
	{
		const CString& strLink = it->first;

		if (tstrnicmp(strLink, strPrefix, nLength) == 0)
		{
			// Delete value, but remember key.
			astrLinks.Add(strLink);
			delete it->second;
		}
	}

	// Purge all matching links...
	for (size_t i = 0; i < astrLinks.Size(); ++i)
		m_oLinks.erase(astrLinks[i]);
}
开发者ID:chrisoldwood,项目名称:NetDDE,代码行数:27,代码来源:LinkCache.cpp

示例7:

void
CNotificationIDRegistry::Unregister( const CString& keyvalue                      ,
                                     const bool okIfUnknownKeyGiven /* = false */ )
{GUCEF_TRACE;

    m_dataLock.Lock();

    if ( keyvalue.Length() > 0 )
    {
        TRegistryList::iterator i = m_list.find( keyvalue );
        if ( i != m_list.end() )
        {
            m_list.erase( i );
        }
        else
        {
            m_dataLock.Unlock();
            GUCEF_EMSGTHROW( EUnknownKey, "CNotificationIDRegistry::Unregister(): unknown notification key string identifier" );
        }
    }
    else
    {
        m_dataLock.Unlock();
        GUCEF_EMSGTHROW( EUnknownKey, "CNotificationIDRegistry::Unregister(): invalid notification key string identifier" );
    }

    m_dataLock.Unlock();
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:28,代码来源:CNotificationIDRegistry.cpp

示例8: ReadSection

size_t CIniFile::ReadSection(const tchar* pszSection, CStrArray& astrKeys, CStrArray& astrValues)
{
	ASSERT(pszSection);

	CStrArray astrEntries;

	// Read all the entries...
	if (ReadSection(pszSection, astrEntries))
	{
		// Split all entries.
		for (size_t i = 0; i < astrEntries.Size(); ++i)
		{
			// Split into key and value.
			CString strEntry = astrEntries[i];
			size_t  nLength  = strEntry.Length();
			size_t  nSepPos  = strEntry.Find(TXT('='));

			// Key set AND value set?
			if ( (nSepPos > 0) && ((nLength-nSepPos-1) > 0) )
			{
				astrKeys.Add(strEntry.Left(nSepPos));
				astrValues.Add(strEntry.Right(nLength-nSepPos-1));
			}
		}
	}

	ASSERT(astrKeys.Size() == astrValues.Size());

	return astrKeys.Size();
}
开发者ID:chrisoldwood,项目名称:WCL,代码行数:30,代码来源:IniFile.cpp

示例9: Compare

 bool CString::operator==(const CString& str) const {
   if (length_ != str.Length()) {
     return false;
   }
   else {
     return Compare(str) == 0;
   }
 }
开发者ID:mukhin,项目名称:libwebserver,代码行数:8,代码来源:cstring.cpp

示例10: stringBufferAccess

bool
CIniParser::LoadFrom( const CString& iniText )
{GUCEF_TRACE;

    CDynamicBuffer stringBuffer;
    stringBuffer.LinkTo( iniText.C_String(), iniText.Length() );
    CDynamicBufferAccess stringBufferAccess( &stringBuffer, false );
    return LoadFrom( stringBufferAccess );
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:9,代码来源:gucefCORE_CIniParser.cpp

示例11:

  CString::CString(const CString& str)
  : length_(str.Length())
  , reserved_(0) {
    if ((string_ = static_cast<char*>(::malloc(length_ + 1))) == 0) {
      base_throw(InternalError, "malloc failed");
    }

    ::memcpy(static_cast<void*>(string_), str.Str(), length_);
    string_[length_] = '\0';
  }
开发者ID:mukhin,项目名称:libwebserver,代码行数:10,代码来源:cstring.cpp

示例12: GetAttributeValue

CString
CDataNode::GetAttributeValueOrChildValueByName( const CString& name ) const
{
    CString value = GetAttributeValue( name );
    if ( 0 == value.Length() )
    {
        value = GetChildValueByName( name );
    }
    return value;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:10,代码来源:CDataNode.cpp

示例13: MaskMatch

bool CThread::MaskMatch(CString sStr, CString sMask)
{
	sStr.ToLower();

	LPTSTR cp = 0;
	LPTSTR mp = 0;

	LPTSTR s = new TCHAR[sStr.Length() + 1];
	LPTSTR mask = new TCHAR[sMask.Length() + 1];

	lstrcpy(s, sStr.C());
	lstrcpy(mask, sMask.C());

	for (; *s&& *mask != TEXT('*'); mask++, s++)
		if (*mask != *s && *mask != TEXT('?')) return false;

	for (;;)
	{
		if (!*s)
		{
			while (*mask == TEXT('*')) mask++;
			return !*mask;
		}

		if (*mask == TEXT('*'))
		{
			if (!*++mask) return true;
			
			mp = mask;
			cp=s+1;
			continue;
		}

		if (*mask == *s || *mask == TEXT('?'))
		{
			mask++, s++;
			continue;
		}

		mask = mp; s = cp++;
	}
}
开发者ID:demalexx,项目名称:small-backup,代码行数:42,代码来源:Thread.cpp

示例14: GetText

void
CMsWin32Editbox::AppendLine( const CString& line )
{GUCEF_TRACE;

    CString currentText = GetText();
    if ( currentText.Length() > 0 )
    {
        char lastChar = currentText[ currentText.Length()-1 ];
        if ( lastChar == '\n' || lastChar == '\r' )
        {
            currentText += line;
        }
        else
        {
            currentText += "\r\n" + line;
        }
        SetText( currentText );
    }
    else
    {
        SetText( line );
    }
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:23,代码来源:gucefCORE_CMsWin32Editbox.cpp

示例15: RegisterGUIDriver

void
CGUIManager::OnNotify( GUCEF::CORE::CNotifier* notifier                  ,
                       const GUCEF::CORE::CEvent& eventid                ,
                       GUCEF::CORE::CICloneable* eventdata /* = NULL  */ )
{GUCE_TRACE;
    
    if ( GUCEF::GUI::CGUIManager::DriverRegisteredEvent == eventid )
    {
        // Check if the registered driver has a GUCE interface so we can use it
        // at this level. First get the information about the driver
        CString& driverName = static_cast< GUCEF::CORE::TCloneableString* >( eventdata )->GetData();
        GUCEF::GUI::CGUIDriver* basicGucefDriver = GUCEF::GUI::CGUIManager::Instance()->GetGuiDriver( driverName );        
        
        // Now get the property telling us whether its GUCE capable
        CString hasGuceInterfaceStr = basicGucefDriver->GetDriverProperty( CIGUIDriver::HasGuceInterfaceDriverProperty );
        if ( ( hasGuceInterfaceStr.Length() > 0 )                &&
             ( GUCEF::CORE::StringToBool( hasGuceInterfaceStr ) ) )
        {        
            // The newly registered driver is GUCE compatible/capable
            // We register it here for use
            GUCE::GUI::CIGUIDriver* guceDriver = static_cast< GUCE::GUI::CIGUIDriver* >( basicGucefDriver );
            RegisterGUIDriver( driverName, *guceDriver );
        }
    }
    else
    if ( GUCEF::GUI::CGUIManager::DriverUnregisteredEvent == eventid )
    {
        // In case the driver is registered at a GUCE level let's unregister it
        CString& driverName = static_cast< GUCEF::CORE::TCloneableString* >( eventdata )->GetData();
        UnregisterGUIDriver( driverName );
    }
    else
    if ( CORE::CGUCEApplication::VideoSetupCompletedEvent == eventid )
    {
        if ( !Init( CORE::CGUCEApplication::Instance()->GetPrimaryWindowContext() ) )
        {
            // If the GUI module is used the GUI initialization is considered critical.
            // Failure is a terminal error
            CORE::CGUCEApplication::Instance()->Stop();
        }
    }
    else
    if ( CORE::CGUCEApplication::VideoShutdownImminentEvent == eventid )
    {
        ShutdownGUISystems();
    }
}
开发者ID:LiberatorUSA,项目名称:GUCE,代码行数:47,代码来源:CGUIManager.cpp


注:本文中的CString::Length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。