本文整理汇总了C++中wstring::end方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::end方法的具体用法?C++ wstring::end怎么用?C++ wstring::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_nmtoken
bool attribute::is_nmtoken(wstring& s) const
{
ba::trim(s);
bool result = not s.empty();
wstring::iterator c = s.begin();
while (result and ++c != s.end())
result = is_name_char(*c);
return result;
}
示例2:
void Windows8LPIAction::_getFirstLanguage(wstring& regvalue)
{
if (m_languages.size() > 0)
{
regvalue = m_languages[0];
std::transform(regvalue.begin(), regvalue.end(), regvalue.begin(), ::tolower);
return;
}
regvalue.clear();
return;
}
示例3: iswlower
bool iswlower(wstring _String)
{
for (wstring::const_iterator iter = _String.begin(); iter != _String.end(); iter++)
{
if (!iswlower(*iter))
{
return false;
}
}
return true;
}
示例4: WstringToString
string WstringToString( const wstring& wstr )
{
#ifdef _WIN32
int n = (int)wstr.size();
string str( n+1, '\0' );
WideCharToMultiByte( CP_ACP, 0, wstr.c_str(), -1, (LPSTR)str.data(), n+1, NULL, NULL );
str.resize( n );
return str;
#else
return string( wstr.begin(), wstr.end() );
#endif
}
示例5:
/// <summary>Calculates the length of a match between item and a string</summary>
/// <param name="txt">The text.</param>
/// <returns>Length of match in characters</returns>
int SuggestionList::SuggestionItem::Match(const wstring& txt) const
{
int len = 0;
// Compare 'n' characters of input + key
for (auto t = txt.begin(), k = Key.begin(); t != txt.end() && k != Key.end(); ++t, ++k)
if (*t == *k)
++len;
// Return count
return len;
}
示例6: parse
void url::parse(const wstring& url_s)
{
const wstring prot_end(L"://");
wstring::const_iterator prot_i = search(url_s.begin(), url_s.end(), prot_end.begin(), prot_end.end());
protocol_.reserve(distance(url_s.begin(), prot_i));
transform(url_s.begin(), prot_i, back_inserter(protocol_), ptr_fun<int, int>(tolower)); // protocol is icase
if (prot_i == url_s.end())
return;
advance(prot_i, prot_end.length());
wstring::const_iterator path_i = find(prot_i, url_s.end(), '/');
host_.reserve(distance(prot_i, path_i));
std::copy(prot_i, path_i, back_inserter(host_));
auto found = host_.find_first_of(L'@');
if (found != std::string::npos)
{
auto creds = host_.substr(0, found);
auto found2 = creds.find_first_of(L':');
if (found2 != std::string::npos)
{
user_ = creds.substr(0, found2);
passw_ = creds.substr(found2+1);
}
host_ = host_.substr(found+1);
}
// host is icase
wstring::const_iterator query_i = find(path_i, url_s.end(), '?');
path_.assign(path_i, query_i);
if (query_i != url_s.end())
++query_i;
query_.assign(query_i, url_s.end());
}
示例7: open
bool DataToken::open(const wstring &filename, DT_MODE mode) {
if (active && !close()) return false;
O_MODE = mode;
string str(filename.begin(), filename.end());
//int openflags = O_WRONLY | O_TRUNC;
//if (mode == O_READ) openflags = O_RDONLY;
string openflags = (mode == O_WRITE) ? "wb" : "rb";
// fd = ::open(str.c_str(), openflags);
fd = ::fopen(str.c_str(), openflags.c_str());
if (!fd) return false;
active = true;
return true;
}
示例8: is_names
bool attribute::is_names(wstring& s) const
{
bool result = true;
ba::trim(s);
if (not s.empty())
{
wstring::iterator c = s.begin();
wstring t;
while (result and c != s.end())
{
result = is_name_start_char(*c);
t += *c;
++c;
while (result and c != s.end() and is_name_char(*c))
{
t += *c;
++c;
}
if (c == s.end())
break;
result = isspace(*c);
++c;
t += ' ';
while (isspace(*c))
++c;
}
swap(s, t);
}
return result;
}
示例9: getImgInfo
ImgAttr Parser::getImgInfo(wstring content)
{
ImgAttr img;
content.erase(remove(content.begin(), content.end(), '\t'), content.end());
wstring contentInfo = content;
const wregex re(L"(<img[^>]*src=['|\"](.*?)['|\"].*?>)", regex::icase);
wsmatch results;
if (regex_match(contentInfo.cbegin(), contentInfo.cend(), results, re))
{
img.src = results[2];
wcout << "img.src = " << img.src << endl;
}
else
{
const wregex re2(L"(<img[^>]*data-src=['|\"](.*?)['|\"].*?>)", regex::icase);
if (regex_match(contentInfo.cbegin(), contentInfo.cend(), results, re2))
{
img.src = results[2];
wcout << "img.src = " << img.src << endl;
}
}
const wregex rew(L"(<img[^>]*width=['|\"](.*?)['|\"].*?>)", regex::icase);
if (regex_match(contentInfo.cbegin(), contentInfo.cend(), results, rew))
{
img.width = results[2];
wcout << "img.width = " << img.width << endl;
}
const wregex reh(L"(<img[^>]*height=['|\"](.*?)['|\"].*?>)", regex::icase);
if (regex_match(contentInfo.cbegin(), contentInfo.cend(), results, reh))
{
img.height = results[2];
wcout << "img.height = " << img.height << endl;
}
return img;
}
示例10: trimright
void StrUtils::trimright( wstring& s )
{
wstring::difference_type dt;
wstring::reverse_iterator it;
for( it = s.rbegin(); it != s.rend(); it++ )
if( !StrUtils::isspace( *it ) )
break;
dt = s.rend() - it;
s.erase( s.begin() + dt, s.end() );
}
示例11: towuppoer
wstring towuppoer(wstring _String)
{
wstring _Result;
_Result.reserve(_String.length());
for (wstring::const_iterator iter = _String.begin(); iter != _String.end(); iter++)
{
_Result += towupper(*iter);
}
return _Result;
}
示例12: while
//Delete white spaces from the end and the begining of the string
wstring
Utils::trim(wstring str) {
wstring::iterator it;
while ((str.length()>0)&&((*(it=str.begin()))==L' ')) {
str.erase(it);
}
while ((str.length()>0)&&((*(it=(str.end()-1)))==L' ')) {
str.erase(it);
}
return str;
}
示例13: setCurrentState
/*
setCurrentState - This method sets this sprite to the newState
state and starts its animtion sequence from the beginning.
*/
void AnimatedSprite::setCurrentState(wstring newState)
{
string cs(currentState.begin(), currentState.end());
string ns(newState.begin(), newState.end());
if (strcmp(cs.c_str(), ns.c_str()) != 0)
{
// SET THE ANIMATION STATE
currentState = newState;
// AND RESET OUR COUNTERS
animationCounter = 0;
frameIndex = 0;
}
}
示例14: calculateTextWidth
int SpriteManager::calculateTextWidth(wstring text, unsigned int fontId) {
float width = 0;
wchar_t previousLetter = *(text.begin());
for (std::wstring::iterator it = text.begin(); it != text.end(); ++it) {
Glyph g = renderer->getFontManager()->getGlyph(fontId, *it);
float kerning = 0;
if (it != text.begin() && g.kerning.find(previousLetter) != g.kerning.end()) {
kerning = (*(g.kerning.find(previousLetter))).second;
}
width += kerning;
width += g.advanceX;
previousLetter = *it;
}
return width;
}
示例15: escape
/* Escapes quotes for CSV format used by Meterpreter Extension */
wstring escape(const wstring& s)
{
wstring res;
wstring::const_iterator it = s.begin();
while (it != s.end())
{
wchar_t c = *it++;
if (c == L'"')
{
res += L'"';
}
res += c;
}
return res;
}