本文整理汇总了C++中tstring::data方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::data方法的具体用法?C++ tstring::data怎么用?C++ tstring::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tstring
的用法示例。
在下文中一共展示了tstring::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: editSTableLiteralValue
void CAipi_STableGlobalLiteral::editSTableLiteralValue(long id, tstring value)
{
CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd();
CMainFrame::g_mSTableGlobalLiteral::iterator iter;
if( !pMainFrame->gmSTableGlobalLiteral.empty())
{
int found = findSTableLiteralMembers( id );
if( found != NOT_FOUND )
{
pMainFrame->gmSTableGlobalLiteral.erase(id);
addSymbol(m_STGLitId, m_STGLitName, m_STGLitType, value);
CString str;
AfxMessageBox(_T("OLD VALUE"));
str.Format(m_STGLitValue.data());
AfxMessageBox(str);
AfxMessageBox(_T("EDIT VALUE"));
str.Format(value.data());
AfxMessageBox(str);
str.Format(_T("%d" ), m_STGLitType);
AfxMessageBox(str);
AfxMessageBox(m_STGLitName.data());
}
}
}
示例2: equal_dir
bool equal_dir(const tstring& a, const tchar* b, size_t b_len) {
TM_ASSERT(b);
size_t a_len = a.size();
if (a_len && a[a_len - 1] == path_delim) --a_len;
if (b_len && b[b_len - 1] == path_delim) --b_len;
if (b_len != a_len) return false;
return memcmp(a.data(), b, b_len * sizeof(tchar)) == 0;
}
示例3: maybe_have_delim
int lazy_protocol::maybe_have_delim(tstring const& input)
{
size_t pos = input.find_first_of(waiter_delim_.data(), waiter_delim_.size());
if( pos == tstring::npos ) {
again();
return 0;
}
return call(waiter_method_, tstring(input.data(), pos));
}
示例4: basename
std::string basename(tstring const& name)
{
std::string::size_type p = name.find_last_of("/\\");
if( p == tstring::npos ) {
return name.str();
} else {
return std::string(name.data()+p+1, name.size()-p-1);
}
}
示例5: maybe_have_enough_bytes
int lazy_protocol::maybe_have_enough_bytes(tstring const& input)
{
if( input.size() < waiter_count_ ) {
again();
return 0;
}
return call(waiter_method_, tstring(input.data(), waiter_count_));
}
示例6: GetFileFullPathNameWithCurrentDir
tstring FileUtil::GetFileFullPathNameWithCurrentDir(const tstring &filename)
{
tchar buf[BUF_SIZE] = { _T('\0') };
tchar **lppPart = NULL;
DWORD ret = ::GetFullPathName(filename.data(), BUF_SIZE, buf, lppPart);
if (ret == 0)
return filename;
return buf;
}
示例7: dirname
std::string dirname(tstring const& name)
{
if( name.size() == 0 ) return ".";
tstring::size_type p = name.find_last_of("/\\");
if( p == tstring::npos ) {
return ".";
} else if( p == 0 ) {
return "/";
} else {
return std::string(name.data(), p);
}
}
示例8: cmp
int tstring::cmp(tstring const& other) const {
size_t common_length = std::min(size(),other.size()); // WINDOWS min macro workaround
int r = std::memcmp(data(), other.data(), common_length);
if( r != 0 )
return r;
if( tstring::size() > other.size() )
return -1;
else if( tstring::size() < other.size() )
return 1;
else
return 0;
}
示例9:
static std::string find_variant(tstring const& filename, std::vector<std::string> const& extensions)
{
std::string pathext;
for( std::vector<std::string>::const_iterator iext = extensions.begin(); iext != extensions.end(); ++iext ) {
pathext.reserve(filename.size() + iext->size());
pathext.assign(filename.data(), filename.size());
pathext.append(*iext);
if( fs::exists(pathext) ) {
return pathext;
}
}
return "";
}
示例10: while
void write_all(output_stream& output, tstring const& data)
{
using tinfra::fail;
using tinfra::tsprintf;
size_t to_write = data.size();
size_t buffer_to_write_index = 0;
while( to_write > 0 ) {
const int w = output.write(data.data() + buffer_to_write_index, to_write);
if( to_write != 0 && w == 0 ) {
fail(tsprintf("unable to save data, %i bytes left", to_write),
"write() unexpectedly returned 0");
}
to_write -= w;
buffer_to_write_index += w;
}
}
示例11: join_append
static void join_append(std::string& result, tstring component, bool& separator_flag)
{
if( component.size() > 0 ) {
const bool start_last_is_separator = result.size() > 0 && (result[result.size()-1] == '/');
const bool first_char_of_component_is_separator = (component[0] == '/');
if( start_last_is_separator && first_char_of_component_is_separator ) {
// if we already have XXX/ and add /FOO then
// just advance one char in added component
component = component.substr(1);
} else if( separator_flag && !first_char_of_component_is_separator ) {
// if we need separator and it's not already
// in place, add it
result.append("/");
}
result.append(component.data(), component.size());
const bool result_last_is_separator = (result[result.size()-1] == '/');
separator_flag = !result_last_is_separator;
}
}
示例12: is_executable
bool is_executable(tstring const& name, std::vector<std::string> const& extensions)
{
// check existence
if( !tinfra::fs::exists(name) )
return false;
// check correct extension
const size_t name_len = name.size();
for( std::vector<std::string>::const_iterator iext = extensions.begin();
iext != extensions.end(); ++iext)
{
const std::string& ext = *iext;
const size_t extlen = ext.size();
if( name_len < extlen )
continue;
const tstring actual_ext = name.substr(name_len-extlen, extlen);
if( compare_no_case(actual_ext.data(), ext.data(), extlen) == 0 ) {
return true;
}
}
return false;
}
示例13: write
int output_stream::write(tstring const& data)
{
return this->write(data.data(), data.size());
}
示例14: SetStringValue
int RegistryKey::SetStringValue(tchar const *name, tstring &value)
{
SXR(RegSetValueEx(mKey, name, 0, REG_SZ, (Byte *)value.data(), (DWORD)value.size()));
return ERROR_SUCCESS;
}
示例15: set_srcdir
void set_srcdir(tstring const& x)
{
srcdir.assign(x.data(), x.size());
}