本文整理汇总了C++中tString::Len方法的典型用法代码示例。如果您正苦于以下问题:C++ tString::Len方法的具体用法?C++ tString::Len怎么用?C++ tString::Len使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tString
的用法示例。
在下文中一共展示了tString::Len方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SplitUserName
//! split a fully qualified user name in authority and username part
void nKrawall::SplitUserName( tString const & original, tString & username, tString & authority )
{
std::ostringstream filter;
for( int i = original.Len()-2; i >=0 ; --i )
{
if ( original[i] == '@' )
{
username = original.SubStr( 0, i );
authority = original.SubStr( i+1, original.Len() - i -2 );
return;
}
}
username = original;
authority = "";
}
示例2: BrokenScramblePassword
// scramble a password locally (so it does not have to be stored on disk)
void nKrawall::BrokenScramblePassword(const tString& password,
nScrambledPassword &scrambled)
{
md5_state_t state;
md5_init(&state);
md5_append(&state, (md5_byte_t const *)(password.c_str()), password.Len());
md5_finish(&state, scrambled.content);
}
示例3: se_CountColorCodes
/**
* Example: se_CountColorCodes( "0xfff000" ) -> 1
*
* @return The number of color codes in s.
*/
static int se_CountColorCodes( const tString & s )
{
int colorCodes = ( s.Len() - tColoredString::RemoveColors( s ).Len() ) / 8;
if ( colorCodes < 0 )
colorCodes = 0;
return colorCodes;
}
示例4: SplitBaseAuthorityName
void nKrawall::SplitBaseAuthorityName( tString const & authority, tString & base )
{
for( int i = 1; i < authority.Len(); ++i )
{
if ( authority[i] == '/' )
{
base = authority.SubStr( 0, i );
return;
}
}
base = authority;
return;
}
示例5: MayRequirePassword
bool nKrawall::MayRequirePassword(tString& adress, unsigned int port)
{
return true;
// TODO: Check for krawall adress
if (adress.Len() < 4)
return false;
if (!strncmp(adress, "127.", 4))
return true;
return false;
}
示例6: ExtractConnectionInformation
// *****************************************************************************
// *
// * ExtractConnectionInformation()
// *
// * Accepted formats
// * - armagetronad://<server>[:<port>]
// * - <server>[:<port>]
// *
// *****************************************************************************
//!
//! @raw raw commandline string
//! @servername store extracted servername here
//! @port store port here
//!
// *****************************************************************************
void ExtractConnectionInformation( tString &raw, tString &servername, tString &port )
{
// BUG: case sensitive
if ( raw.StartsWith("armagetronad://") )
{
raw.RemoveSubStr(0, 15);
}
int portStart = strcspn( raw, ":" );
// Is a port given?
if ( portStart != raw.Len() - 1 )
{
servername = raw.SubStr( 0, portStart );
port = raw.SubStr( portStart + 1 );
}
else
{
servername = raw;
port = "4534";
}
}