本文整理汇总了C++中std::_tstring::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ _tstring::c_str方法的具体用法?C++ _tstring::c_str怎么用?C++ _tstring::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::_tstring
的用法示例。
在下文中一共展示了_tstring::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sl
_variant_t Get(const std::_tstring & section, const std::_tstring & label, const _variant_t & defaultVal)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
SectionLabelDefault sl(SectionLabel(section, label), defaultVal);
ConfigCacheT::const_iterator found = m_cache.find(sl.first);
if(sl == GLOBAL_USER && found != m_cache.end())
if (!CString(m_cache[sl.first]).IsEmpty())
return m_cache[sl.first];
if(sl == GLOBAL_PASSWORD && found != m_cache.end())
if (!CString(m_cache[sl.first]).IsEmpty())
return m_cache[sl.first];
if (!m_CfgPath.empty())
{
if (found != m_cache.end())
return found->second;
CString _defaultVal = defaultVal, _val;
if (!m_Cfg.GetString(section.c_str(), label.c_str(), _val, _defaultVal))
{
//ATLTRACE(_T("GetString(%s,%s,Err=%x)\r\n"), section, label, ::GetLastError() );
_val = _defaultVal;
}
SectionLabel id(section, label);
if (CString(m_cache[id]).CompareNoCase(_val) != 0)
{
m_cache[id] = _val;
_variant_t retVal = m_cache[sl.first];
proc.unlock();
on_refresh(&id);
return retVal;
}
}
return m_cache[sl.first];
}
示例2: ShowDiff
void CMainFrame::ShowDiff(const std::_tstring & lhs, const std::_tstring & lhsHeader, const std::_tstring & rhs, const std::_tstring & rhsHeader)
{
m_sourceEclView.SetReadOnly(false);
m_sourceEclView.SetText(lhs.c_str());
m_sourceEclView.SetReadOnly(true);
m_targetEclView.SetReadOnly(false);
m_targetEclView.SetText(rhs.c_str());
m_targetEclView.SetReadOnly(true);
m_diffView.SetText(lhs, rhs);
}
示例3: MessageBox
bool MessageBox(HWND hwnd, std::_tstring &error_title, std::_tstring &error_msg)
{
if (m_errExists)
{
if (::MessageBox(hwnd, error_title.c_str(), error_msg.c_str(), MB_ICONASTERISK | MB_YESNO) == IDYES)
return true;
m_errExists = false;
}
else
::MessageBox(hwnd, error_title.c_str(), error_msg.c_str(), MB_ICONASTERISK);
return false;
}
示例4: SetTabData
void CDockableDataViews::SetTabData(const std::_tstring & label, const ITable * data, bool hasRowNum, const roxie::CSearchRowVector & searchResults)
{
StringResultMap::iterator itr = m_dataTabs.find(label);
if (itr == m_dataTabs.end())
{
m_dataTabs[label] = new CDataView();
m_dataTabs[label]->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
m_dataTabs[label]->SetFont(&afxGlobalData.fontRegular);
m_wndTab.InsertTab(m_dataTabs[label], label.c_str(), 0, 0, FALSE);
}
m_dataTabs[label]->SetData(data, hasRowNum, searchResults);
ActivateTab(m_dataTabs[label]);
}
示例5: threadLoadAttribute
static void threadLoadAttribute(CWorkspaceItem * self, std::_tstring moduleLabel, std::_tstring attributeLabel, std::_tstring attributeType)
{
self->m_loaded = LOADING_STARTED;
CComPtr<IAttribute> attribute = NULL;
if (!moduleLabel.empty() && !attributeLabel.empty())
{
attribute = self->m_repository->GetAttributeFast(moduleLabel.c_str(), attributeLabel.c_str(), CreateIAttributeType(attributeType), 0, true, true, true);
if (!attribute)
attribute = self->m_repository->GetAttributePlaceholder(moduleLabel.c_str(), attributeLabel.c_str(), CreateIAttributeType(attributeType));
}
self->SetAttr(attribute);
self->m_loaded = LOADING_FINISHED;
}
示例6: SetTabPropertyGrid
void CDockablePropertyGridViews::SetTabPropertyGrid(const std::_tstring & label, const ITable* data)
{
StringPropertyGridMap::const_iterator itr = m_propertyGridTabs.find(label);
if (itr == m_propertyGridTabs.end())
{
bool edges = boost::algorithm::iequals(label, _T("edges"));
StlLinked<CPropertyGridView> propertyGridView = new CPropertyGridView(edges ? XGMML_CAT_EDGE : XGMML_CAT_VERTEX);
m_propertyGridTabs[label] = propertyGridView.get();
propertyGridView->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
propertyGridView->SetFont(&afxGlobalData.fontRegular);
m_wndTab.AddTab(propertyGridView, label.c_str(), 0, FALSE);
propertyGridView->SetOwner(m_owner);
}
m_propertyGridTabs[label]->SetData(data);
}
示例7: Update
void Update(const std::_tstring &cluster, const std::_tstring &status, const std::vector<ns4__ActiveWorkunit *> &running)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
m_cluster = cluster.c_str();
m_queue.clear();
m_status = status.c_str();
for(std::size_t i = 0; i < running.size(); ++i)
{
if (running[i]->Instance && m_cluster.CompareNoCase(running[i]->Instance->c_str()) == 0)
{
// Creating a workunit can cause a deadlock with the active tree, so set noBroadcast to true.
CComPtr<Dali::IWorkunit> wu = Dali::CreateWorkunit(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali"), running[i], true);
ATLASSERT(wu);
m_queue.push_back(wu.p);
}
}
}
示例8: Update
void Update(const std::_tstring & name, ITable * result)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
m_name = name.c_str();
m_result->LoadFrom(result);
m_total = result->GetRowCount();
}
示例9: CWorkspaceItem
CWorkspaceItem(IRepository * repository, const std::_tstring & data)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
m_repository = repository;
m_props.deserializeXML(data.c_str());
m_id = m_props.Get(PERSIST_FILEPATH);
UpdateID();
m_attributeLoaded = false;
m_workunitLoaded = false;
m_loaded = LOADING_UNKNOWN;
}
示例10: Set
void Set(const std::_tstring & section, const std::_tstring & label, const _variant_t & val)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
SectionLabelDefault sl(SectionLabel(section, label), _T(""));
if(sl == GLOBAL_USER)
{
InitConfigPath(m_CfgName, _T("cfg"));
}
SectionLabel id(section, label);
if (m_cache.find(id) == m_cache.end() || CString(m_cache[id]).CompareNoCase(CString(val)) != 0)
{
if (!m_CfgPath.empty() && sl != GLOBAL_PASSWORD)
{
CString _val = val;
if ( !m_Cfg.PutString(section.c_str(), label.c_str(), _val) )
{
ATLTRACE(_T("PutString(%s,%s,Err=%x)\r\n"), section, label, ::GetLastError() );
}
}
m_cache[id] = val;
proc.unlock();
on_refresh(&id);
}
}
示例11: OnOk
bool OnOk(const std::_tstring & label, std::_tstring &error_title, std::_tstring &error_msg)
{
CComPtr<IRepository> rep = ::AttachRepository();
std::_tstring error;
if (rep->Label(label.c_str(), error))
{
if (!error.length())
{
return true;
}
}
error_title = ERR_INVALID_IDENTIFIER_TITLE;
error_msg = error;
return false;
}
示例12: SetTabEcl
void CDockableDataViews::SetTabEcl(const std::_tstring & localFile, int row, const CUniqueID & id)
{
std::_tstring label = localFile;
StringSourceMap::iterator itr = m_sourceTabs.find(localFile);
if (itr == m_sourceTabs.end())
{
StlLinked<CLocalDataView> attributeDataView = new CLocalDataView();
m_sourceTabs[localFile] = attributeDataView.get();
attributeDataView->Create(NULL, localFile.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
attributeDataView->SetFont(&afxGlobalData.fontRegular);
boost::filesystem::path p = stringToPath(localFile);
m_wndTab.AddTab(attributeDataView, pathToWString(p.filename()).c_str(), 0, FALSE);
attributeDataView->SetOwner(m_owner);
attributeDataView->SetSource(localFile);
}
m_sourceTabs[localFile]->SetBreakpointLocation(row, id);
}
示例13: hash_string
void CLine::hash_string(const std::_tstring & s)
{
// Calc Hash
boost::crc_32_type computer;
computer.reset();
computer.process_bytes(s.c_str(), sizeof(TCHAR) * s.length());
m_hash = computer.checksum();
// Calc Anchor Hash
bool prevIsGraph = true;
static boost::crc_32_type anchorComputer;
anchorComputer.reset();
for (unsigned int i = 0; i < s.length(); ++i)
{
bool isGraph = iswgraph(s[i]) != 0 || s[i] == '\r' || s[i] == '\n';
if (isGraph)
anchorComputer.process_bytes(&s[i], sizeof(TCHAR));
prevIsGraph = isGraph;
}
m_anchorHash = anchorComputer.checksum();
}
示例14: Check
void Check(const std::_tstring & _url, const std::_tstring & _product)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
std::string url = CT2A(_url.c_str());
std::string product = CT2A(_product.c_str());
try
{
boost::asio::io_service io_service;
// Get a list of endpoints corresponding to the server name.
tcp::resolver resolver(io_service);
tcp::resolver::query query(url, "http");
tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
tcp::resolver::iterator end;
// Try each endpoint until we successfully establish a connection.
tcp::socket socket(io_service);
boost::system::error_code error = boost::asio::error::host_not_found;
while (error && endpoint_iterator != end)
{
socket.close();
socket.connect(*endpoint_iterator++, error);
}
if (error)
throw boost::system::system_error(error);
// Form the request. We specify the "Connection: close" header so that the
// server will close the socket after transmitting the response. This will
// allow us to treat all data up until the EOF as the content.
boost::asio::streambuf request;
std::ostream request_stream(&request);
request_stream << "GET " << product << " HTTP/1.0\r\n";
request_stream << "Host: " << url << "\r\n";
request_stream << "Accept: */*\r\n";
request_stream << "Connection: close\r\n\r\n";
// Send the request.
boost::asio::write(socket, request);
// Read the response status line. The response streambuf will automatically
// grow to accommodate the entire line. The growth may be limited by passing
// a maximum size to the streambuf constructor.
boost::asio::streambuf response;
boost::asio::read_until(socket, response, "\r\n");
// Check that response is OK.
std::istream response_stream(&response);
std::string http_version;
response_stream >> http_version;
unsigned int status_code;
response_stream >> status_code;
std::string status_message;
std::getline(response_stream, status_message);
if (!response_stream || http_version.substr(0, 5) != "HTTP/")
{
m_error = "Invalid response";
return;
}
if (status_code != 200)
{
m_error = "Response returned with status code ";
try {
m_error += boost::lexical_cast<std::string>(status_code);
} catch (const boost::bad_lexical_cast &) {
m_error += "\n";
}
return;
}
// Read the response headers, which are terminated by a blank line.
boost::asio::read_until(socket, response, "\r\n\r\n");
// Process the response headers.
std::string header;
while (std::getline(response_stream, header) && header != "\r")
m_header + header + "\n";
std::stringstream m_responseStream;
// Write whatever content we already have to output.
if (response.size() > 0)
m_responseStream << &response;
// Read until EOF, writing data to output as we go.
while (boost::asio::read(socket, response, boost::asio::transfer_at_least(1), error))
m_responseStream << &response;
if (error != boost::asio::error::eof)
throw boost::system::system_error(error);
m_response = CA2T(m_responseStream.str().c_str());
boost::algorithm::trim_if(m_response, boost::algorithm::is_any_of(_T("\r\n")));
}
catch (const std::exception & ex)
{
m_error = ex.what();
}
return;
}
示例15: DoSearch
void CRepositoryFilterView::DoSearch(CRepositoryFilterView *self, std::_tstring searchText, std::_tstring searchModule, std::_tstring searchUser, DoSearchOptions searchOptions, std::_tstring dateTime)
{
CComPtr<IRepository> rep = AttachRepository();
IAttributeVectorPtr * results = new IAttributeVectorPtr(); //This is released in the submit done.
int foundCount = rep->FindAttributes(searchText, searchModule, searchUser, searchOptions.mode, searchOptions.sandboxed, searchOptions.checkedout, searchOptions.locked, searchOptions.orphaned, searchOptions.modifiedSince ? dateTime.c_str() : _T(""), *results);
::PostMessage(self->m_hWnd, CWM_SUBMITDONE, (WPARAM)(results), foundCount);
}