本文整理汇总了C++中UnicodeString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::size方法的具体用法?C++ UnicodeString::size怎么用?C++ UnicodeString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fit_str
UnicodeString fit_str(const UnicodeString& path, unsigned size) {
if (path.size() <= size) return path;
size -= 3; // place for ...
unsigned ls = size / 2; // left part size
unsigned rs = size - ls; // right part size
return path.left(ls) + L"..." + path.right(rs);
}
示例2: Equals
bool XMLReader::Equals(const UnicodeString & a, const char * b)
{
size_t bLen = std::strlen(b);
if (a.size() != bLen) return false;
for (size_t i = 0; i < bLen; ++i) {
if (a[i] != UnicodeChar(b[i])) return false;
}
return true;
}
示例3: error_dlg
void error_dlg(Error& e, const UnicodeString& message) {
UnicodeString msg;
msg.add(far_get_msg(MSG_PLUGIN_NAME)).add('\n');
if (message.size() != 0) msg.add(word_wrap(message, get_msg_width())).add('\n');
UnicodeString err_msg = word_wrap(e.message(), get_msg_width());
if (err_msg.size() != 0) msg.add(err_msg).add('\n');
msg.add_fmt(L"%S:%u v.%u.%u.%u.%u"PLUGIN_TYPE, &extract_file_name(oem_to_unicode(e.file)), e.line, g_version.major, g_version.minor, g_version.patch, g_version.revision);
far_message(c_error_dialog_guid, msg, 0, FMSG_WARNING | FMSG_MB_OK);
}
示例4: IsNameToken
bool XMLReader::IsNameToken(const UnicodeString & token)
{
// Nmtoken ::= (NameChar)+
size_t n = token.size();
if (n == 0) return false;
for (size_t i = 0; i < n; ++i) {
if (! IsNameChar(token[i])) return false;
}
return true;
}
示例5: IsName
bool XMLReader::IsName(const UnicodeString & name)
{
// Name ::= (Letter | '_' | ':') (NameChar)*
size_t n = name.size();
if (n == 0) return false;
UnicodeChar c = name[0];
if ((c == UnicodeChar('_')) || (c == UnicodeChar(':')) || IsLetter(c)) {
for (size_t i = 1; i < n; ++i) {
if (! IsNameChar(name[i])) return false;
}
}
return true;
}
示例6: word_wrap
UnicodeString word_wrap(const UnicodeString& message, unsigned wrap_bound) {
UnicodeString msg = message;
unsigned limit = wrap_bound;
unsigned idx = -1;
for (unsigned i = 0; i < msg.size(); i++) {
if (i >= limit) {
if (idx != -1) {
msg.insert(idx, '\n');
i = idx + 1;
limit = idx + 2 + wrap_bound;
idx = -1;
continue;
}
}
if (msg[i] == ' ') idx = i;
}
return msg;
}
示例7: Render
void AppGuiBase::Render( Gwen::Skin::Base* skin )
{
m_iFrames++;
if ( m_fLastSecond < Gwen::Platform::GetTimeInSeconds() )
{
Controls::Layout::Table* logTable = logWindow->m_TextOutput->GetTable();
UnicodeString lastStatus;
if( logTable->RowCount(0) ) {
lastStatus = logTable->GetRow( logTable->RowCount(0)-1 )->GetText(0).GetUnicode();
lastStatus.erase(lastStatus.size()-1);
}
m_StatusBar->SetText( lastStatus + Gwen::Utility::Format( L" - %i fps", /*m_iFrames * 2 */ (int)ofGetFrameRate() ) );
m_fLastSecond = Gwen::Platform::GetTimeInSeconds() + 0.5f;
m_iFrames = 0;
}
BaseClass::Render( skin );
}
示例8: unicode_to_oem
// unicode <-> oem codepage conversions
void unicode_to_oem(AnsiString& oem_str, const UnicodeString& u_str) {
unsigned size = u_str.size() + 1;
int res = WideCharToMultiByte(CP_OEMCP, 0, u_str.data(), size, oem_str.buf(u_str.size()), size, NULL, NULL);
if (res == 0) FAIL(SystemError());
oem_str.set_size(res - 1);
}
示例9: del_trailing_slash
UnicodeString del_trailing_slash(const UnicodeString& file_path) {
if ((file_path.size() < 2) || (file_path.last() != L'\\')) return file_path;
else return file_path.left(file_path.size() - 1);
}
示例10: add_trailing_slash
UnicodeString add_trailing_slash(const UnicodeString& file_path) {
if ((file_path.size() == 0) || (file_path.last() == L'\\')) return file_path;
else return file_path + L'\\';
}
示例11: unquote
void unquote(UnicodeString& str) {
if ((str.size() >= 2) && (str[0] == '"') && (str.last() == '"')) {
str.remove(0);
str.remove(str.size() - 1);
}
}
示例12: extract_file_name
const UnicodeString extract_file_name(const UnicodeString& file_path) {
unsigned pos = file_path.rsearch('\\');
if (pos == -1) pos = 0;
else pos++;
return file_path.slice(pos, file_path.size() - pos);
}
示例13: center
UnicodeString center(const UnicodeString& str, unsigned width) {
if (str.size() >= width) return str;
unsigned lpad = (width - str.size()) / 2;
unsigned rpad = width - str.size() - lpad;
return UnicodeString::format(L"%.*c%S%.*c", lpad, ' ', &str, rpad, ' ');
}
示例14:
const UnicodeString & __fastcall UnicodeString::operator +=(const UnicodeString & rhs)
{
Data.append(rhs.Data.c_str(), rhs.size());
return *this;
}
示例15: msg_dlg
void msg_dlg(const UnicodeString& message) {
UnicodeString msg;
msg.add(far_get_msg(MSG_PLUGIN_NAME)).add('\n');
if (message.size() != 0) msg.add(word_wrap(message, get_msg_width())).add('\n');
far_message(c_error_dialog_guid, msg, 0, FMSG_MB_OK);
}