本文整理汇总了C++中std::wstring::end方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::end方法的具体用法?C++ wstring::end怎么用?C++ wstring::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::wstring
的用法示例。
在下文中一共展示了wstring::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
BEGIN_INANITY
std::string Strings::Unicode2UTF8(const std::wstring& str)
{
std::string res;
utf8::unchecked::utf16to8(str.begin(), str.end(), std::back_inserter(res));
return res;
}
示例2:
template <> inline std::string encode< char, wchar_t >( const std::wstring& source )
{
std::string result;
result.resize( source.length() );
std::transform(source.begin(), source.end(), result.begin(), detail::narrow());
return result;
}
示例3: init
BigArray<T>::BigArray(std::wstring fileName, unsigned long r, unsigned long c)
{
std::string fName = std::string(fileName.begin(), fileName.end());
init(fName, r, c);
MPI_Barrier(MPI_COMM_WORLD);
}
示例4: strFilename
KeyValueFileParser::KeyValueFileParser(const wstring& wstrFilename, bool bStopOnEmptyLine, const wstring& wstrToken, const std::wstring& wstrEndToken)
{
string strFilename(wstrFilename.begin(), wstrFilename.end());
string strToken(wstrToken.begin(), wstrToken.end());
string strEndToken(wstrEndToken.begin(), wstrEndToken.end());
m_bFileReadable = ParseFile(strFilename, bStopOnEmptyLine, strToken, strEndToken);
}
示例5: strFilename
LargeRAWFile::LargeRAWFile(const std::wstring& wstrFilename, uint64_t iHeaderSize):
m_bIsOpen(false),
m_bWritable(false),
m_iHeaderSize(iHeaderSize)
{
string strFilename(wstrFilename.begin(), wstrFilename.end());
m_strFilename = strFilename;
}
示例6: ResourcesDirMakeUrl
void CSalsitaExtensionHelper::ResourcesDirMakeUrl(const wchar_t *resourcesDir, const wchar_t *relativeUrl, std::wstring &pageUrl)
{
pageUrl.assign(L"file:///");
pageUrl.append(resourcesDir);
ResourcesDirNormalize(pageUrl);
pageUrl.append(relativeUrl);
std::replace(pageUrl.begin(), pageUrl.end(), L'\\', L'/');
}
示例7: copy_string
bool copy_string(const ComponentBaseImpl& comp, const std::wstring& str, WCHAR_T** out) {
if (*out = comp.alloc<WCHAR_T[]>(size_t(str.size() + 1))) {
std::copy(str.begin(), str.end(), *out);
return true;
}
return false;
}
示例8: loadModelFromFile
void IfcPPReaderSTEP::loadModelFromFile( const std::wstring& file_path, shared_ptr<IfcPPModel>& target_model )
{
// if file content needs to be loaded into a plain model, call resetModel() before loadModelFromFile
std::wstring ext = file_path.substr( file_path.find_last_of( L"." ) + 1 );
if( boost::iequals( ext, "ifc" ) )
{
// ok, nothing to do here
}
else if( boost::iequals( ext, "ifcXML" ) )
{
// TODO: implement xml reader
messageCallback( "ifcXML not yet implemented", StatusCallback::MESSAGE_TYPE_ERROR, __FUNC__ );
return;
}
else if( boost::iequals( ext, "ifcZIP" ) )
{
// TODO: implement zip uncompress
messageCallback( "ifcZIP not yet implemented", StatusCallback::MESSAGE_TYPE_ERROR, __FUNC__ );
return;
}
else
{
std::wstringstream strs;
strs << "Unsupported file type: " << ext;
messageCallback( strs.str().c_str(), StatusCallback::MESSAGE_TYPE_ERROR, __FUNC__ );
return;
}
// open file
#ifdef _MSC_VER
std::ifstream infile(file_path.c_str(), std::ifstream::in );
#else
std::string file_path_str( file_path.begin(), file_path.end() );
std::ifstream infile(file_path_str.c_str(), std::ifstream::in );
#endif
if( !infile.is_open() )
{
std::wstringstream strs;
strs << "Could not open file: " << file_path.c_str();
messageCallback( strs.str().c_str(), StatusCallback::MESSAGE_TYPE_ERROR, __FUNC__ );
return;
}
// get length of file content
std::streampos file_size = infile.tellg();
infile.seekg( 0, std::ios::end );
file_size = infile.tellg() - file_size;
infile.seekg( 0, std::ios::beg );
// read file content into string
std::string buffer( (int)file_size, '\0' );
infile.read( &buffer[0], file_size );
infile.close();
loadModelFromString( buffer, target_model );
}
示例9: result
std::string WideToUTF8(const std::wstring& in)
{
// TODO: Eventually we want this function to convert from Unicode
// characters to UTF-8 characters, but do this for now, just so
// that on non-Win32 platforms we can use the same code.
std::string result(in.length(), ' ');
std::copy(in.begin(), in.end(), result.begin());
return result;
}
示例10: condition
Failure::Failure(
const std::wstring& theCondition,
const std::string& theFileName,
long theLineNumber)
: condition(theCondition.begin(), theCondition.end()),
fileName(theFileName),
lineNumber(theLineNumber)
{
}
示例11: setTextContent
void DOMElement::setTextContent(const std::wstring & ws)
{
if(isNull())
return;
std::basic_string<XMLCh> xs(ws.begin(), ws.end());
XELEM(m_wrapped)->setTextContent(xs.c_str());
}
示例12:
ConnectionListener::ConnectionListener(const std::wstring &name, TelldusCore::EventRef waitEvent) {
d = new PrivateData;
d->waitEvent = waitEvent;
d->name = "/tmp/" + std::string(name.begin(), name.end());
d->running = true;
this->start();
}
示例13:
static
std::string
convert(std::wstring const & w)
{
std::string s;
utf8::utf32to8(w.begin(),w.end(),
std::back_inserter(s));
return s;
}
示例14: string
std::string StringUtils::wstring_To_Utf8(const std::wstring& widestring)
{
size_t widesize = widestring.length();
if (sizeof(wchar_t) == 2)
{
size_t utf8size = 3 * widesize + 1;
std::string resultstring;
resultstring.resize(utf8size, '\0');
const UTF16* sourcestart = reinterpret_cast<const UTF16*>(widestring.c_str());
const UTF16* sourceend = sourcestart + widesize;
UTF8* targetstart = reinterpret_cast<UTF8*>(&resultstring[0]);
UTF8* targetend = targetstart + utf8size;
ConversionResult res = ConvertUTF16toUTF8(&sourcestart, sourceend, &targetstart, targetend, strictConversion);
if (res != conversionOK)
{
return std::string(widestring.begin(), widestring.end());
}
*targetstart = 0;
return std::string(resultstring.c_str());
}
else if (sizeof(wchar_t) == 4)
{
size_t utf8size = 4 * widesize + 1;
std::string resultstring;
resultstring.resize(utf8size, '\0');
const UTF32* sourcestart = reinterpret_cast<const UTF32*>(widestring.c_str());
const UTF32* sourceend = sourcestart + widesize;
UTF8* targetstart = reinterpret_cast<UTF8*>(&resultstring[0]);
UTF8* targetend = targetstart + utf8size;
ConversionResult res = ConvertUTF32toUTF8(&sourcestart, sourceend, &targetstart, targetend, strictConversion);
if (res != conversionOK)
{
return std::string(widestring.begin(), widestring.end());
}
*targetstart = 0;
return std::string(resultstring.c_str());
}
else
{
assert(false);
}
return "";
}
示例15: rq
template<> void ScriptInterface::ToJSVal<std::wstring>(JSContext* cx, JS::MutableHandleValue ret, const std::wstring& val)
{
JSAutoRequest rq(cx);
utf16string utf16(val.begin(), val.end());
JS::RootedString str(cx, JS_NewUCStringCopyN(cx, reinterpret_cast<const char16_t*> (utf16.c_str()), utf16.length()));
if (str)
ret.setString(str);
else
ret.setUndefined();
}