Пример #1
0
 void deleteForward()
 {
     if (selectionStart != caretPos) {
         unsigned min = std::min(caretPos, selectionStart);
         unsigned max = std::max(caretPos, selectionStart);
         text.erase(text.begin() + min, text.begin() + max);
         selectionStart = caretPos = min;
     }
     else if (caretPos < text.length()) {
         unsigned oldCaret = caretPos;
         caretPos += 1;
         text.erase(text.begin() + oldCaret, text.begin() + caretPos);
         selectionStart = caretPos = oldCaret;
     }
     
 }
Пример #2
0
/** I'm not sure what this does really --mxcl */
std::wstring
Moose::fixStr(const std::wstring& str)
{
    std::wstring ret;

    if (str.length() == 0) return str;

    // Mac strings store the length in the first char of the string:
    size_t len = (size_t)str[0];
    ret = str.substr(1);
    if(len > 0 && len < ret.length())
    {
        ret = ret.substr(0,len);
    }
    return ret;
}
Пример #3
0
WgCharSeqLiteral::WgCharSeqLiteral( const std::wstring& str, int ofs, int len )
{
	const wchar_t * p = str.c_str();
	int strlen = str.length();

	if( ofs + len > strlen )
	{
		if( ofs > strlen )
			ofs = strlen;
		len = strlen - ofs;
	}

    m_type      = UTF16;
    m_pChar     = p + ofs;
    m_nbChars   = len;
}
Пример #4
0
//-----------------------------------------------------------------------------
int MGL_LOCAL_PURE mglFindArg(const std::wstring &str)
{
	register long l=0,k=0,i;
	for(i=0;i<long(str.length());i++)
	{
		if(str[i]=='\'') l++;
		if(str[i]=='{') k++;
		if(str[i]=='}') k--;
		if(l%2==0 && k==0)
		{
			if(str[i]=='#' || str[i]==';')	return -i;
			if(str[i]<=' ')	return i;
		}
	}
	return 0;
}
Пример #5
0
std::vector<std::wstring> html_extract(const std::wstring& filename, const std::wstring& path_str) {
	if (!path_str.length()) return std::vector<std::wstring>();
	std::vector<std::wstring> re;
	boost::property_tree::wptree pt;
	std::wstringstream ss;
	std::wifstream file(filename);
	if (!file) throw std::runtime_error("cannot open file");
	static_assert(sizeof(wchar_t) == 2, "In function html_extract, wchar_t is not UTF16.");
	file.imbue(std::locale(std::locale(), new std::codecvt_utf8_utf16<wchar_t>()));//UTF-8 -> UTF16(wchar_t in Windows.)
	convert_html_to_xml(file, ss);
	read_xml(ss, pt, boost::property_tree::xml_parser::no_comments);
	const auto path = detail::parse_path(path_str);
	auto& body = pt.get_child(L"html.body");//HTML has body tag. if not exist, exception will be thrown.
	detail::html_extract_impl(re, body, path);//analyse
	return re;
}
void InvokeCallback(JNIEnv *env, jobject obj, jobject callback, std::wstring filename)
{
	jstring j_filename = env->NewString((const jchar *)filename.c_str(), filename.length());

	jclass fileClass = env->FindClass("java/io/File");
	jmethodID fileConstructor = env->GetMethodID(fileClass, "<init>", "(Ljava/lang/String;)V");
	jobject fileObj = env->NewObject(fileClass, fileConstructor, j_filename);

	jclass resultClass = env->FindClass("org/eclipse/mylyn/sandbox/search/ui/SearchResult");
	jmethodID resultConstructor = env->GetMethodID(resultClass, "<init>", "(Ljava/io/File;)V");
	jobject resultObj = env->NewObject(resultClass, resultConstructor, fileObj);

	jclass jc = env->GetObjectClass(callback);
	jmethodID mid = env->GetMethodID(jc, "searchResult","(Lorg/eclipse/mylyn/sandbox/search/ui/SearchResult;)V");
	env->CallObjectMethod(callback, mid, resultObj);
}
Пример #7
0
	std::string WStringToUTF8(const std::wstring& s)
	{
		std::string os;
		for (size_t i = 0; i < s.length(); ++i)
		{
			const wchar_t c(s[i]);
			if (c < 0x80)
			{
				os += static_cast<uint8_t>(c);
			}
			else if (c < 0x800)
			{
				os += static_cast<uint8_t>(((c>>6)&0x1F)|0xC0);
				os += static_cast<uint8_t>((c&0x3F)|0x80);
			}
			else if (c < 0xd800)
Пример #8
0
//--------------------------------------------------------------------------------
void TextActor::DrawLine( const std::wstring& text )
{
	// Check the length of the string, and use the line justification to advance 
	// the cursor an appropriate amount before actually drawing the line of text.

	float fWidth = m_pSpriteFont->GetStringWidth( text ) * m_fPhysicalScale;

	switch( m_LineJustification )
	{
	case LineJustification::LEFT:
		// No change needed - just draw the text from teh current cursor position
		break;
	case LineJustification::CENTER:
		// Advance cursor to the 'left' by half the string width
		AdvanceCursor( -fWidth * 0.5f );
		break;
	case LineJustification::RIGHT:
		// Advance the cursor by the full size of the string.
		AdvanceCursor( -fWidth );
	}


	for ( UINT i = 0; i < text.length(); i++ )
	{
		wchar_t character = text[i];

		if ( character == ' ' ) {
			
			// For a space, we simply move over one space's width for the next
			// character.
			Space();

		} else if ( character == '\n' ) {
			
			// Go back to the original location on xdir, and advance along ydir.
			NewLine();

		} else {
			
			// If this is an actual character, then draw it!
			DrawCharacter( character );

		}
	}

	//NewLine();
}
Пример #9
0
std::vector<std::wstring> StringUtil::tokenize(const std::wstring& str, const std::wstring& delimiters, bool allowEmptyTokenString)
{
	std::vector<std::wstring> tokens;
	std::wstring::size_type delimPos = 0, tokenPos = 0, pos = 0;

	if (str.length() < 1)
		return tokens;

	while (true)
	{
		delimPos = str.find_first_of(delimiters, pos);
		tokenPos = str.find_first_not_of(delimiters, pos);

		if (std::wstring::npos != delimPos)
		{
			if (std::wstring::npos != tokenPos)
			{
				if (tokenPos < delimPos)
				{
					tokens.push_back(str.substr(pos, delimPos - pos));
				}
				else
				{
					if (allowEmptyTokenString)	tokens.push_back(L"");
				}
			}
			else
			{
				if (allowEmptyTokenString) tokens.push_back(L"");
			}
			pos = delimPos + 1;
		}
		else
		{
			if (std::wstring::npos != tokenPos)
			{
				tokens.push_back(str.substr(pos));
			}
			else
			{
				if (allowEmptyTokenString) tokens.push_back(L"");
			}
			break;
		}
	}
	return tokens;
}// tokenize(wstring)
Пример #10
0
LSTATUS SetRegValue(HKEY rootKey, std::wstring wsSubKey, std::wstring wsData) {
	HKEY key;
	LSTATUS retValue = RegOpenKeyEx(rootKey, _T(""), 0, KEY_WRITE | KEY_READ, &key);
	if (retValue != ERROR_SUCCESS) {
		std::cout << "打开注册表失败" << std::endl;
		return retValue;
	}

	//依次创建wsSubKey路径中的子键
	std::vector<std::wstring> subKeyVec;
	int newPos = 0;
	int oldPos = 0;
	while (true) {
		newPos = wsSubKey.find(_T("\\"), oldPos);
		if (newPos != std::string::npos) {
			subKeyVec.push_back(wsSubKey.substr(oldPos, newPos - oldPos));
			oldPos = newPos + 1;
		}
		else {
			break;
		}
	}
	if (subKeyVec.size() == 0) {
		return ERROR_INVALID_FUNCTION;
	}

	HKEY fatherKey = key;
	HKEY subKey = 0;
	for (size_t i = 0; i < subKeyVec.size(); ++i) {
		DWORD dw;
		RegCreateKeyEx(fatherKey,
			subKeyVec[i].c_str(),
			NULL,
			NULL,
			REG_OPTION_NON_VOLATILE,
			KEY_WRITE | KEY_READ, NULL,
			&subKey,
			&dw);
		RegCloseKey(fatherKey);
		fatherKey = subKey;
	}

	retValue = RegSetValue(subKey, _T(""), REG_SZ, wsData.c_str(), wsData.length());
	RegCloseKey(subKey);

	return retValue;
}
Пример #11
0
std::wstring ELStripLeadingSpaces(std::wstring input)
{
  size_t i = 0;

  //< Search input for the first non-space character
  while (i < input.length())
  {
    if (input.at(i) != ' ')
    {
      break;
    }

    i++;
  }

  return input.substr(i, std::wstring::npos);
}
Пример #12
0
std::string WideToNarrow(const std::wstring& ws)
{
    const std::locale locale(""); // WARNING: This only needs to be done one time.
    typedef std::codecvt<wchar_t, char, std::mbstate_t> converter_type;
    const converter_type& converter = std::use_facet<converter_type>(locale);
    std::vector<char> to(ws.length() * converter.max_length());
    std::mbstate_t state;
    const wchar_t* from_next;
    char* to_next;
    const converter_type::result result = converter.out(state, ws.data(), ws.data() + ws.length(), from_next, &to[0], &to[0] + to.size(), to_next);
    if (result == converter_type::ok || result == converter_type::noconv)
    {
        const std::string s(&to[0], to_next);
        return s;
    }
    return "";
}
Пример #13
0
//获取视频第5秒的截图
bool CCommonInterface::GetVideoPic(std::wstring lsVideoPath, std::wstring &lsPicPath, int iTimes, std::wstring strCachePath)
{
	//ffmpeg -ss 5 -i test.mp4 -f image2 -y  -s 350x240 test1.jpg
	//如果没有指定本地路径,先要获取一个临时路径用于存储生成的图片
	if (lsPicPath.length() <= 0)
	{
		wstring strFilePath = strCachePath;
		strFilePath += _T("\\TempPic\\");
		if (!PathFileExists(strFilePath.c_str()))
		{
			CCommonInterface comter;
			comter.CreateDir(strFilePath);
		}
		SYSTEMTIME stime = { 0 };
		GetLocalTime(&stime);
		TCHAR szCurrentTime[MAX_PATH] = { 0 };
		_stprintf(szCurrentTime, _T("%s%02d%02d%02d%02d%02d%04d.jpg"),
			_T("Pic"), stime.wMonth, stime.wDay, stime.wHour, stime.wMinute, stime.wSecond, stime.wMilliseconds);
		strFilePath += szCurrentTime;
		lsPicPath = strFilePath;
	}
	CCommonInterface ComInterface;
	SHELLEXECUTEINFO sei = { sizeof(sei) };
	sei.lpVerb = _T("open");
	sei.nShow = SW_NORMAL;
	TCHAR szCacheUpdateTempPath[MAX_PATH] = { 0 };
	wstring strFfmpegPath = strCachePath;
	strFfmpegPath += _T("\\Ffmpeg\\ffmpeg.exe");
	TCHAR szParames[MAX_PATH * 2] = { 0 };
	StringCchPrintf(szParames, MAX_PATH * 2, _T("-ss %d -i \"%s\" -f image2 -y -s 854x480 \"%s\""),
		iTimes,
		lsVideoPath.c_str(),
		lsPicPath.c_str());
	sei.lpFile = strFfmpegPath.c_str();
	sei.lpParameters = szParames;
	sei.nShow = SW_HIDE;
	sei.fMask = SEE_MASK_NOCLOSEPROCESS;
	//GetLogFun(Info)(_T("....ffmpeg的参数%s"), sei.lpParameters);
	if (ShellExecuteEx(&sei))
	{
		//等待进程结束
		WaitForSingleObject(sei.hProcess, INFINITE);
		return true;
	}
	return false;
}
Пример #14
0
std::string w2mb(const std::wstring& v)
{
	if (v.empty())
		return{};

	size_t wideLen = v.length();

	int iLen = WideCharToMultiByte(CP_ACP, 0, v.c_str(), wideLen, nullptr, 0, NULL, NULL);
	if (iLen <= 0)
		return{};

	std::string rv(iLen, '\0');
	iLen = WideCharToMultiByte(CP_ACP, 0, v.c_str(), wideLen, &rv[0], iLen, NULL, NULL);
	if (iLen)
		return rv;
	return{};
}
Пример #15
0
RichTextLineList combine_lines (std::wstring &str, const RichTextLineC *linec, size_t nlines)
{
	str.clear ();
	RichTextLineList line_list (nlines);
	RichTextLineList::iterator it = line_list.begin ();
	for (; nlines; --nlines) {
		it->id = linec->id;
		size_t len = wcslen (linec->text);
		it->offset = str.length ();
		it->len = len;
		it->screen_wid = ucs_width (linec->text, len);
		str.append (linec->text, len);
		++linec;
		++it;
	}
	return line_list;
}
Пример #16
0
unsigned int RvFindRegex::directoryCheck(const std::wstring& directory, const std::wstring& pathRoot) const
{
    if (pathRoot.empty())
        return DIRECTORY_DONTCARE;
    size_t dirLength = directory.length();
    if (dirLength > pathRoot.size())
    {
        if (boost::algorithm::istarts_with(directory,pathRoot))
            return DIRECTORY_INCLUDE;
        else
            return DIRECTORY_EXCLUDE;
    }
    if (boost::algorithm::istarts_with(pathRoot,directory))
        return DIRECTORY_INCLUDE;
    else
        return DIRECTORY_EXCLUDE;
}
Пример #17
0
OS_EXPORT int FileUtilities::makeDirAll(const std::wstring& aDirPath)
{
    JELOG2(EJavaFile);
    bool ableToOpen = true;
    std::wstring path;
    wchar_t *last, *tok, *delim =L"/" ;
    wchar_t *stringToTokenize = new wchar_t[aDirPath.length()+ 1];
    wcscpy(stringToTokenize, aDirPath.c_str());

    for (tok = wcstok(stringToTokenize,delim,&last); tok!=NULL;
            tok = wcstok(NULL, delim, &last))
    {
        path += std::wstring(tok);
        path += L"/";
        char *dirName = JavaCommonUtils::wstringToUtf8(path);
        if (ableToOpen)
        {
            DIR* wDirHandle = opendir(dirName);
            if (!wDirHandle)
            {
                ableToOpen = false;
                if (mkdir(dirName,0666)<0)
                {
                    WLOG1(EJavaFile,"FileUtilities::makeDirAll: Directory Creation Failed : %s",dirName);
                    delete[] dirName;
                    delete[] stringToTokenize;
                    return -1;
                }
            }
            closedir(wDirHandle); 
        }
        else
        {
            if (mkdir(dirName,0666)<0)
            {
                ELOG1(EJavaFile, "FileUtilities::makeDirAll: Directory Creation Failed : %s",dirName);
                delete[] dirName;
                delete[] stringToTokenize;
                return -1;
            }
        }
        delete[] dirName;
    }
    delete[] stringToTokenize;
    return 0;
}
Пример #18
0
int wdeGetText(WebElement* element, StringWrapper** result)
{
	if (!element || !element->element) { return -1; }

	const std::wstring originalString(element->element->getText());
	size_t length = originalString.length() + 1;
	wchar_t* toReturn = new wchar_t[length];

	wcscpy_s(toReturn, length, originalString.c_str());

	StringWrapper* res = new StringWrapper();
	res->text = toReturn;
	
	*result = res;

	return 0;
}
Пример #19
0
// Do not assert in this function since it is used by the asssertion code!
static std::string SysWideToMultiByte(const std::wstring& wide, UINT32 code_page=CP_UTF8) 
{
    int wide_length = static_cast<int>(wide.length());
    if (wide_length == 0)
        return std::string();

    // Compute the length of the buffer we'll need.
    int charcount = ::WideCharToMultiByte(code_page, 0, wide.data(), wide_length, NULL, 0, NULL, NULL);
    if (charcount == 0)
        return std::string();

    std::string mb;
    mb.resize(charcount);
    ::WideCharToMultiByte(code_page, 0, wide.data(), wide_length, &mb[0], charcount, NULL, NULL);

    return mb;
}
Пример #20
0
int wdGetTitle(WebDriver* driver, StringWrapper** result)
{
	if (!driver || !driver->ie) return -1;

	const std::wstring originalString(driver->ie->getTitle());
	size_t length = originalString.length() + 1;
	wchar_t* toReturn = new wchar_t[length];

	wcscpy_s(toReturn, length, originalString.c_str());

	StringWrapper* res = new StringWrapper();
	res->text = toReturn;
	
	*result = res;

	return 0;
}
Пример #21
0
std::pair<bool, const UChar*>	nodeMatchReachedTest(CNode& node, std::wstring& test)
{
	CFilterOwner owner;
	owner.SetInHeader(L"Host", L"www.host.org");
	std::wstring url = L"http://www.host.org/path/page.html?query=true#anchor";
	owner.url.parseUrl(url);
	//owner.cnxNumber = 1;
	owner.fileType = "htm";
	CFilter filter(owner);
	Proxydomo::MatchData matchData(&filter);

	const UChar* start = test.c_str();
	const UChar* stop = test.c_str() + test.length();

	const UChar* ret = node.match(start, stop, &matchData);
	return { ret != nullptr, matchData.reached };
}
Пример #22
0
  /**
   * Set the log path directory.
   * If we pass a NULL argument then we want to stop/disable the logging.
   * @param const std::wstring& wPath the log path we will be using.
   * @param const std::wstring& wPrefix the prefix of the filename we will create, (default is blank).
   * @param const std::wstring& wExtention the file extension.
   * @param size_t maxFileSize the max file size in megabytes.
   * @return bool success or not
   */
  bool LogEvent::Initialise(const std::wstring& wPath, const std::wstring& wPrefix, const std::wstring& wExtention, size_t maxFileSize )
  {
    // we cannot do that more than once.
    if (Initialised())
    {
      return false;
    }

    // try and get the lock
    myodd::threads::AutoLock autoLock(*this);

    // check again if we are initialised.
    if (Initialised())
    {
      return false;
    }

    // initialise the log file.
    if (!m_logFile.Initialise(wPath, wPrefix, wExtention, maxFileSize ))
    {
      return false;
    }

    // we are now initialised
    _initialised = true;

    //  of the path is zero then we are not really creating anything
    // this just mean that we are not logging anything.
    if (wPath.length() == 0)
    {
      return true;
    }

    // send the last few messages
    for (auto it = m_logMessages.begin();
      it != m_logMessages.end();
      ++it
      )
    {
      const _LogMessage& lm = (*it);
      LogToFile(lm.GetType(), lm.GetMessage());
    }// each messages.

    return true;
  }
Пример #23
0
	RECT D3DFontObject9::GetTextExtent(std::wstring textString, RECT rect, uint32 flags) const {
		if (m_d3dxFont != nullptr) {
			uint32 length = textString.length();
			bool trailingSpace = (length != 0 && textString.back() == L' ');
			if (trailingSpace)
				textString.back() = L'.';

			m_d3dxFont->DrawTextW(nullptr, textString.data(), length, &rect, flags | DT_CALCRECT, 0);

			// adjust the rectangle...
			if (trailingSpace) {
				rect.right += m_spaceExtent.x;
				rect.right -= m_pointExtent.x;
			}
		}

		return rect;
	}
Пример #24
0
//TODO Use \\?\ to go past 260 char limit
void GetIniFile(std::wstring &iniFile)
{
	iniFile.clear();
	if(!IniDir.length()) {
		WCHAR tmp[MAX_PATH] = {0};
		GetModuleFileName(GetModuleHandle((LPWSTR)hInst), tmp, MAX_PATH);

		std::wstring path(tmp);
		unsigned last = path.find_last_of(L"\\");
		iniFile = path.substr(0, last);
		iniFile.append(L"\\inis");
		CreateDirectory(iniFile.c_str(), NULL);
		iniFile.append(L"\\USBqemu-wheel.ini");
	} else {
		iniFile.append(IniDir);
		iniFile.append(L"USBqemu-wheel.ini");
	}
}
Пример #25
0
 /**
    Validate the non required parameters
    @detailed This used in the NxNetRoute Provider code to ensure that the user
              has supplied only valid digits for the fields that require only digits.
    @param[in] param A wstring which may contain alphanumeric characters
    @return bool Returns true if the parameter string consists only of numeric digits
 */
  bool NxNetRouteEnumeration::ValidateNonRequiredParameters(std::wstring &param)
  {
      if (param.empty())
      {
          param = L"0";
      }
      else
      {
          for(uint i = 0; i < param.length(); i++)
          {
              if(!isdigit(param[i]))
              {
                  return false;
              }
          }
      }
      return true;
  }
unsigned gfx::draw_text_line(float px, float py, float fs, const std::wstring &text, const Font &fnt,
    unsigned idx)
{
  for(;; ++idx)
  {
    if(idx >= text.length())
    {
      return 0;
    }
    wchar_t cc = text[idx];
    if(cc == '\n')
    {
      return idx + 1;
    }

    px += draw_glyph(px, py, fs, fnt.getGlyph(cc));
  }
}
Пример #27
0
HRESULT ui::UIListBoxItem::__RecreateSubTextLayout(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                   ID2D1RenderTarget *pRenderTarget, const std::wstring &text,
                                                   CComPtr<IDWriteTextLayout> &textLayout,
                                                   DWRITE_TEXT_METRICS &textMetrics, UIRectangle &textRect) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  UNREFERENCED_PARAMETER(pRenderTarget);
  CComPtr<IDWriteTextLayout> oldTextLayout = textLayout;
  textLayout = nullptr;
  CHK_FATAL_HRESULT(pD3DInteropHelper->GetDWriteFactory()->CreateTextLayout(
      text.c_str(), static_cast<UINT32>(text.length()), oldTextLayout, textRect.width, textRect.height, &textLayout));
  CHK_FATAL_HRESULT(textLayout->GetMetrics(&textMetrics));
#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
Пример #28
0
bool Engine::check_record(USN_RECORD * record, std::wstring s_filename)
{
	WCHAR * filename;
	WCHAR * filenameend;

	filename = (WCHAR *)(((BYTE *)record) + record->FileNameOffset);
	filenameend = (WCHAR *)(((BYTE *)record) + record->FileNameOffset + record->FileNameLength);

	if (filenameend - filename != 8) return FALSE;

	int buffer = s_filename.length();
	const wchar_t * wc_filename = s_filename.c_str();

	if (wcsncmp(filename, wc_filename, buffer) != 0) return FALSE;

	//show_record(record);
	return TRUE;
}
Пример #29
0
bool DeleteRegKey(std::wstring szKey, std::wstring szSubkey)
{
  bool bOK = false;

  HKEY hKey;
  LONG ec = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, szKey.c_str(), 0, KEY_ALL_ACCESS, &hKey);
  if(ec == ERROR_SUCCESS)
  {
    if(szSubkey.length() > 0)
      ec = ::RegDeleteKey(hKey, szSubkey.c_str());

    bOK = (ec == ERROR_SUCCESS);

    ::RegCloseKey(hKey);
  }

  return bOK;
}
Пример #30
0
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 "";
}