forked from organicmaps/organicmaps-tmp
[Tizen] Commit of tizen_stirng_utils (some strange commit)
This commit is contained in:
parent
aeb40a9417
commit
ca12f547ad
2 changed files with 40 additions and 3 deletions
|
@ -0,0 +1,28 @@
|
|||
#include "tizen_string_utils.hpp"
|
||||
#include "../../std/vector.hpp"
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wignored-qualifiers"
|
||||
#include <FBase.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
string FromTizenString(Tizen::Base::String const & str_tizen)
|
||||
{
|
||||
string utf8Str;
|
||||
if (str_tizen.GetLength() == 0)
|
||||
return utf8Str;
|
||||
Tizen::Base::ByteBuffer * pBuffer = Tizen::Base::Utility::StringUtil::StringToUtf8N(str_tizen);
|
||||
if (pBuffer)
|
||||
{
|
||||
int byteCount = pBuffer->GetLimit();
|
||||
|
||||
byteCount--; // Don't copy Zero at the end
|
||||
if (byteCount > 0)
|
||||
{
|
||||
vector<char> chBuf(byteCount);
|
||||
pBuffer->GetArray((byte *)&chBuf[0], 0, byteCount);
|
||||
utf8Str.assign(chBuf.begin(), chBuf.end());
|
||||
}
|
||||
delete pBuffer;
|
||||
}
|
||||
return utf8Str;
|
||||
}
|
|
@ -1,4 +1,13 @@
|
|||
#ifndef TIZEN_STRING_UTILS_HPP
|
||||
#define TIZEN_STRING_UTILS_HPP
|
||||
#pragma once
|
||||
#include "../../std/string.hpp"
|
||||
|
||||
#endif // TIZEN_STRING_UTILS_HPP
|
||||
namespace Tizen
|
||||
{
|
||||
namespace Base
|
||||
{
|
||||
class String;
|
||||
}
|
||||
}
|
||||
|
||||
//Convert from Tizen string to std::string
|
||||
string FromTizenString(Tizen::Base::String const & str_tizen);
|
||||
|
|
Loading…
Add table
Reference in a new issue