本文整理汇总了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();
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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]);
}
示例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();
}
示例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();
}
示例9: Compare
bool CString::operator==(const CString& str) const {
if (length_ != str.Length()) {
return false;
}
else {
return Compare(str) == 0;
}
}
示例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 );
}
示例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';
}
示例12: GetAttributeValue
CString
CDataNode::GetAttributeValueOrChildValueByName( const CString& name ) const
{
CString value = GetAttributeValue( name );
if ( 0 == value.Length() )
{
value = GetChildValueByName( name );
}
return value;
}
示例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++;
}
}
示例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 );
}
}
示例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();
}
}