本文整理汇总了C++中wxCharBuffer类的典型用法代码示例。如果您正苦于以下问题:C++ wxCharBuffer类的具体用法?C++ wxCharBuffer怎么用?C++ wxCharBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxCharBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: strlen
void PreviewDlg::InsertBase(vector<char>& html, const wxString& path) { // static
if (path.empty()) return;
const char* basestart = "<base href=\"";
const char* baseend = "\" />\n";
vector<char> base;
// Build base string
base.insert(base.end(), basestart, basestart + strlen(basestart));
const wxCharBuffer buf = path.mb_str(wxConvUTF8);
const unsigned int len = strlen(buf.data());
base.insert(base.end(), buf.data(), buf.data()+len);
base.insert(base.end(), baseend, baseend + strlen(baseend));
// Check if we have a head tag in the first 200 bytes
vector<char>::iterator insertpos = html.begin();
unsigned int end = wxMin(300, html.size());
if (end > 6) {
end -= 6;
for (vector<char>::iterator c = html.begin(); c != html.begin() + end; ++c) {
if (*c == '<' && *(c+1) == 'h' && *(c+2) == 'e' && *(c+3) == 'a' && *(c+4) == 'd' && *(c+5) == '>') {
insertpos = c + 6;
break;
}
}
}
html.insert(insertpos, base.begin(), base.end());
}
开发者ID:baguatuzi,项目名称:e,代码行数:31,代码来源:PreviewDlg.cpp
示例2: ADEBUG
AdbConReply* AdbConnection::send_layer0(wxString s, bool send_only){
if(old){
time_t td = m_sw.Time();
if(td<m_opt->delay){
ADEBUG(SP1("| Sleep: %d", m_opt->delay-td));
wxThread::Sleep(m_opt->delay-td);
}
/*if(!send_only && m_cb->abort()){
logout(true);
return NULL;
}*/
} else old = true;
m_sw.Start();
wxString cen = s;
int i = cen.Find(wxT("pass="));
if(i>0&&i<=cen.Length()){
int j = cen.find(wxT("&"), i);
if(j>0&&j<=cen.Length()) cen = cen.substr(0, i+5)+wxT("xxxxx")+cen.substr(j);
}
ADEBUG(wxT("> ") + cen);
//const char * outb = s.mb_str(wxConvUTF8);
const wxCharBuffer outb = s.mb_str(wxConvUTF8);
m_udp->SendTo((*m_remoteaddr), /*s.ToAscii().data()*/outb, strlen(outb.data()));//(wxUint32)s.Length());
if(m_udp->Error())
ADEBUG(wxT("! Failed to send datagram!"));
if(send_only) return NULL;
char buf[UDP_BUF_MAX];
wxDateTime t0 = wxDateTime::UNow();
do{
m_udp->RecvFrom((*m_remoteaddr),buf, UDP_BUF_MAX);
if(m_cb->abort()){
logout(true);
return NULL;
}
wxTimeSpan delta = wxDateTime::UNow()-t0;
if(delta.GetMilliseconds()>m_opt->timeout){
AERROR(wxT("! Timed out!"));
return NULL;
}
}while(m_udp->Error());
lastTimeUsed = m_sw.Time();
m_sw.Start();
buf[m_udp->LastCount()-1] = '\0';
wxString replymsg(buf,wxConvUTF8);
ADEBUG(wxT("< ")+replymsg);
AdbConReply* r = new AdbConReply(replymsg);
return r;
}
开发者ID:arucard21,项目名称:AniDB,代码行数:60,代码来源:anidb-net.cpp
示例3: ReadDir
bool isoimage::ReadDir(const wxString &path, stat_vector_t& stat_vector)
{
const wxCharBuffer buffer = path.ToAscii();
const char *spath = buffer.data();
return m_image.readdir(spath, stat_vector);
}
开发者ID:trieck,项目名称:source,代码行数:7,代码来源:isoimage.cpp
示例4: pattern
bool TagEntry::TypedefFromPattern(const wxString& tagPattern,
const wxString& typedefName,
wxString& name,
wxString& templateInit,
bool nameIncludeTemplate)
{
wxString pattern(tagPattern);
pattern.StartsWith(wxT("/^"), &pattern);
const wxCharBuffer cdata = pattern.mb_str(wxConvUTF8);
clTypedefList li;
get_typedefs(cdata.data(), li);
if(li.size() == 1) {
clTypedef td = *li.begin();
templateInit = _U(td.m_realType.m_templateDecl.c_str());
if(td.m_realType.m_typeScope.empty() == false) {
name << _U(td.m_realType.m_typeScope.c_str());
if(nameIncludeTemplate) {
name << templateInit;
}
name << wxT("::");
}
name << _U(td.m_realType.m_type.c_str());
return true;
}
return false;
}
开发者ID:huan5765,项目名称:codelite-translate2chinese,代码行数:30,代码来源:entry.cpp
示例5: OpenImage
bool isoimage::OpenImage(const wxString &filename)
{
const wxCharBuffer buffer = filename.ToAscii();
const char *path = buffer.data();
return m_image.open(path, ISO_EXTENSION_ALL);
}
开发者ID:trieck,项目名称:source,代码行数:7,代码来源:isoimage.cpp
示例6: buf
/*static*/
void wxMemoryFSHandlerBase::AddFileWithMimeType(const wxString& filename,
const wxString& textdata,
const wxString& mimetype)
{
const wxCharBuffer buf(textdata.To8BitData());
AddFileWithMimeType(filename, buf.data(), buf.length(), mimetype);
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:9,代码来源:fs_mem.cpp
示例7: GetFileModificationTime
time_t FileUtils::GetFileModificationTime(const wxFileName& filename)
{
wxString file = filename.GetFullPath();
struct stat buff;
const wxCharBuffer cname = file.mb_str(wxConvUTF8);
if(stat(cname.data(), &buff) < 0) { return 0; }
return buff.st_mtime;
}
开发者ID:eranif,项目名称:codelite,代码行数:8,代码来源:fileutils.cpp
示例8: GetCommand
tmCommand RunCmdDlg::GetCommand() const {
tmCommand cmd;
const wxString cmdStr = m_cmdCtrl->GetValue();
cmd.name = cmdStr;
const wxCharBuffer buf = cmdStr.mb_str(wxConvUTF8);
const size_t len = strlen(buf.data());
vector<char> content(buf.data(), buf.data()+len);
cmd.SwapContent(content);
switch(m_inputBox->GetSelection()) {
case 0:
cmd.input = tmCommand::ciNONE;
break;
case 1:
cmd.input = tmCommand::ciSEL;
break;
case 2:
cmd.input = tmCommand::ciDOC;
break;
}
switch(m_outputBox->GetSelection()) {
case 0:
cmd.output = tmCommand::coNONE;
break;
case 1:
cmd.output = tmCommand::coSEL;
break;
case 2:
cmd.output = tmCommand::coDOC;
break;
case 3:
cmd.output = tmCommand::coINSERT;
break;
case 4:
cmd.output = tmCommand::coSNIPPET;
break;
case 5:
cmd.output = tmCommand::coHTML;
break;
case 6:
cmd.output = tmCommand::coTOOLTIP;
break;
case 7:
cmd.output = tmCommand::coNEWDOC;
break;
}
return cmd;
}
开发者ID:joeri,项目名称:e,代码行数:52,代码来源:RunCmdDlg.cpp
示例9: OnInputLineChanged
void ApiHandler::OnInputLineChanged(unsigned int nid, const wxString& text) {
// Look up notifier id
map<unsigned int, IConnection*>::const_iterator p = m_notifiers.find(nid);
if (p == m_notifiers.end()) return;
IConnection& conn = *p->second;
// Send notifier
hessian_ipc::Writer& writer = conn.get_reply_writer();
const wxCharBuffer str = text.ToUTF8();
writer.write_notifier(nid, str.data());
conn.notifier_done();
}
开发者ID:BBkBlade,项目名称:e,代码行数:13,代码来源:ApiHandler.cpp
示例10: ConvertFromUTF8
size_t ConvertFromUTF8(const wxCharBuffer& utf8_buff, const wxMBConv& conv, wxWCharBuffer& wchar_buff,
size_t& wchar_buff_len, wxCharBuffer& dest_buff, size_t& dest_buff_len,
size_t char_len) { // static
// Calculate length of conversion to widechar
size_t wchar_len = wxConvUTF8.MB2WC(NULL, utf8_buff, 0);
if (wchar_len == (size_t)-1) return (size_t)-1; // invalid conversion
// Extend widechar buffer if needed
if (wchar_buff_len < wchar_len + sizeof(wxChar)) {
wchar_buff_len = wchar_len + sizeof(wxChar);
wchar_buff = wxWCharBuffer(wchar_buff_len);
}
// Convert to widechar
wchar_len = wxConvUTF8.MB2WC(wchar_buff.data(), utf8_buff, wchar_buff_len);
if (wchar_len == (size_t)-1) return (size_t)-1; // invalid conversion
// Calculate length of conversion to dest encoding
size_t dest_len = conv.WC2MB(NULL, wchar_buff, 0);
if (dest_len == (size_t)-1) return (size_t)-1; // invalid conversion
// Extend dest buffer if needed
if (dest_buff_len < dest_len + char_len) {
dest_buff_len = dest_len + char_len;
dest_buff = wxCharBuffer(dest_buff_len);
}
// Convert to dest encoding
dest_len = conv.WC2MB(dest_buff.data(), wchar_buff, dest_buff_len);
if (dest_len == (size_t)-1) return (size_t)-1; // invalid conversion
return dest_len;
}
开发者ID:BBkBlade,项目名称:e,代码行数:33,代码来源:Utf.cpp
示例11: locker
void ParseThread::GetFileListToParse(const wxString& filename, wxArrayString& arrFiles)
{
if ( !this->IsCrawlerEnabled() ) {
return;
}
{
wxCriticalSectionLocker locker( TagsManagerST::Get()->m_crawlerLocker );
wxArrayString includePaths, excludePaths;
GetSearchPaths( includePaths, excludePaths );
fcFileOpener::Instance()->ClearResults();
fcFileOpener::Instance()->ClearSearchPath();
for(size_t i=0; i<includePaths.GetCount(); i++) {
fcFileOpener::Instance()->AddSearchPath( includePaths.Item(i).mb_str(wxConvUTF8).data() );
}
for(size_t i=0; i<excludePaths.GetCount(); i++) {
fcFileOpener::Instance()->AddExcludePath(excludePaths.Item(i).mb_str(wxConvUTF8).data());
}
// Invoke the crawler
const wxCharBuffer cfile = filename.mb_str(wxConvUTF8);
// Skip binary files
if(TagsManagerST::Get()->IsBinaryFile(filename)) {
DEBUG_MESSAGE( wxString::Format(wxT("Skipping binary file %s"), filename.c_str()) );
return;
}
// Before using the 'crawlerScan' we lock it, since it is not mt-safe
crawlerScan( cfile.data() );
}
std::set<std::string> fileSet = fcFileOpener::Instance()->GetResults();
std::set<std::string>::iterator iter = fileSet.begin();
for (; iter != fileSet.end(); iter++ ) {
wxFileName fn(wxString((*iter).c_str(), wxConvUTF8));
fn.MakeAbsolute();
if ( arrFiles.Index(fn.GetFullPath()) == wxNOT_FOUND ) {
arrFiles.Add(fn.GetFullPath());
}
}
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:46,代码来源:parse_thread.cpp
示例12: title
void ApiHandler::IpcEditorPrompt(EditorCtrl& editor, IConnection& conn) {
const hessian_ipc::Call& call = *conn.get_call();
// Get the title
const hessian_ipc::Value& v2 = call.GetParameter(1);
const string& t = v2.GetString();
const wxString title(t.c_str(), wxConvUTF8, t.size());
// Show Prompt
WindowEnabler we; // otherwise dlg wont be able to return focus
const wxString text = wxGetTextFromUser(title, _("Input text"), wxEmptyString, &editor);
const wxCharBuffer str = text.ToUTF8();
hessian_ipc::Writer& writer = conn.get_reply_writer();
writer.write_reply(str.data());
}
开发者ID:BBkBlade,项目名称:e,代码行数:17,代码来源:ApiHandler.cpp
示例13: buf
void strStream::CheckString(const wxString& text)
{
wxStringOutputStream sos;
const wxCharBuffer buf(text.To8BitData());
sos.Write(buf, buf.length());
CPPUNIT_ASSERT_EQUAL( text, sos.GetString() );
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:9,代码来源:sstream.cpp
示例14: Load
void wxArchive::Load(wxCharBuffer &buf)
{
if(CanLoad())
{
wxUint32 size = LoadUint32();
if(size > 0)
m_idstr.Read(buf.data(), size);
}
}
开发者ID:BackupTheBerlios,项目名称:bijutsukan-svn,代码行数:9,代码来源:wxArchive.cpp
示例15: ConvertToUTF8
size_t ConvertToUTF8(const char* source, const size_t source_len, const wxMBConv& conv, wxCharBuffer& temp_buff,
size_t& temp_buff_len, wxWCharBuffer& wchar_buff, size_t& wchar_buff_len,
wxCharBuffer& utf8_buff, size_t& utf8_buff_len, size_t char_len) { // static
// We have to copy the source string to a temporary buffer so that we can
// make it null terminated.
if (temp_buff_len < source_len+char_len) {
temp_buff_len = source_len+char_len;
temp_buff = wxCharBuffer(temp_buff_len);
}
memcpy(temp_buff.data(), source, source_len);
for (unsigned int i = 0; i < char_len; ++i) temp_buff.data()[source_len+i] = '\0';
// Calculate length of conversion to widechar
size_t wchar_len = conv.MB2WC(NULL, temp_buff, 0);
if (wchar_len == (size_t)-1) return (size_t)-1; // invalid conversion
// Extend widechar buffer if needed
if (wchar_buff_len < wchar_len + sizeof(wxChar)) {
wchar_buff_len = wchar_len + sizeof(wxChar);
wchar_buff = wxWCharBuffer(wchar_buff_len);
}
// Convert to widechar
wchar_len = conv.MB2WC(wchar_buff.data(), temp_buff, wchar_buff_len);
if (wchar_len == (size_t)-1) return (size_t)-1; // invalid conversion
// Calculate length of conversion to UTF-8
size_t utf8_len = wxConvUTF8.WC2MB(NULL, wchar_buff, 0);
if (utf8_len == (size_t)-1) return (size_t)-1; // invalid conversion
// Extend UTF-8 buffer if needed
if (utf8_buff_len < utf8_len) {
utf8_buff_len = utf8_len + 1;
utf8_buff = wxCharBuffer(utf8_buff_len);
}
// Convert to UTF-8
utf8_len = wxConvUTF8.WC2MB(utf8_buff.data(), wchar_buff, utf8_buff_len);
if (utf8_len == (size_t)-1) return (size_t)-1; // invalid conversion
return utf8_len;
}
开发者ID:BBkBlade,项目名称:e,代码行数:42,代码来源:Utf.cpp
示例16: wxStringTokenize
std::map<std::string,std::string> TagsOptionsData::GetTokensMap() const
{
std::map<std::string,std::string> tokens;
wxArrayString tokensArr = wxStringTokenize(m_tokens, wxT("\r\n"), wxTOKEN_STRTOK);
for (size_t i=0; i<tokensArr.GetCount(); i++) {
//const wxCharBuffer bufKey = _C(
wxString item = tokensArr.Item(i).Trim().Trim(false);
wxString k = item.BeforeFirst(wxT('='));
wxString v = item.AfterFirst(wxT('='));
const wxCharBuffer bufKey = _C(k);
std::string key = bufKey.data();
std::string value;
if (!v.empty()) {
const wxCharBuffer bufValue = _C(v);
value = bufValue.data();
}
tokens[key] = value;
}
return tokens;
}
开发者ID:RVictor,项目名称:EmbeddedLite,代码行数:21,代码来源:tags_options_data.cpp
示例17: _C
std::map<std::string, std::string> TagsOptionsData::GetTokensMap() const
{
std::map<std::string, std::string> tokens;
for(size_t i = 0; i < m_tokens.GetCount(); i++) {
// const wxCharBuffer bufKey = _C(
wxString item = m_tokens.Item(i);
item.Trim().Trim(false);
wxString k = item.BeforeFirst(wxT('='));
wxString v = item.AfterFirst(wxT('='));
const wxCharBuffer bufKey = _C(k);
std::string key = bufKey.data();
std::string value;
if(!v.empty()) {
const wxCharBuffer bufValue = _C(v);
value = bufValue.data();
}
tokens[key] = value;
}
return tokens;
}
开发者ID:05storm26,项目名称:codelite,代码行数:21,代码来源:tags_options_data.cpp
示例18: wxASSERT
void Styler_Syntax::GetTextWithScopes(unsigned int start, unsigned int end, vector<char>& text) {
wxASSERT(start <= end);
wxASSERT(end <= m_doc.GetLength());
// Make sure syntax is valid
if (m_syntax_end < end) {
DoSearch(m_syntax_end, end, end);
}
text.reserve((end - start) * 2);
// Start tag
const wxString& topScope = m_topMatches.subMatcher->GetName();
const wxCharBuffer name = topScope.mb_str();
const size_t len = strlen(name.data());
if (len) {
text.push_back('<');
text.insert(text.end(), name.data(), name.data() + len);
text.push_back('>');
}
XmlText(0, m_topMatches, start, end, text);
// End tag
if (len) {
text.push_back('<');
text.push_back('/');
text.insert(text.end(), name.data(), name.data() + len);
text.push_back('>');
}
}
开发者ID:BBkBlade,项目名称:e,代码行数:31,代码来源:styler_syntax.cpp
示例19: wxT
void cxEnv::GetEnvBlock(wxString& env) const {
for (map<wxString, wxString>::const_iterator p = m_env.begin(); p != m_env.end(); ++p) {
wxString line = p->first;
line += wxT('=');
line += p->second;
//wxLogDebug(wxT("%d: %s"), i, line);
#ifdef __WXMSW__
// Convert to utf8
const wxCharBuffer buf = line.mb_str(wxConvUTF8);
// to avoid unicode chars being mangled by windows automatic
// conversion to oem, we first convert the utf8 text to unicode
// as if it was oem. Windows will convert it back to oem, which
// will then preserve the utf8 encoding.
// We use native MultiByteToWideChar to ensure we get the right
// codepage no matter the current locale.
const size_t len = ::MultiByteToWideChar(CP_OEMCP, 0, buf.data(), -1, NULL, 0);
if (len) {
wxWCharBuffer wBuf(len);
::MultiByteToWideChar(CP_OEMCP, 0, buf.data(), -1, wBuf.data(), len);
env += wBuf;
}
else wxASSERT(false);
//const wxString oemEnv(buf, wxCSConv(wxFONTENCODING_CP437));
#else
env += line;
#endif
env += wxT('\0');
}
// Add end marker
env += wxT('\0');
}
开发者ID:boulerne,项目名称:e,代码行数:38,代码来源:Env.cpp
示例20: GetSearchPaths
void ParseThread::FindIncludedFiles(ParseRequest* req, std::set<std::string>* newSet)
{
wxArrayString searchPaths, excludePaths, filteredFileList;
GetSearchPaths( searchPaths, excludePaths );
DEBUG_MESSAGE( wxString::Format(wxT("Initial workspace files count is %u"), (unsigned int)req->_workspaceFiles.size()) ) ;
for(size_t i=0; i<req->_workspaceFiles.size(); i++) {
wxString name(req->_workspaceFiles.at(i).c_str(), wxConvUTF8);
wxFileName fn(name);
fn.MakeAbsolute();
if(TagsManagerST::Get()->IsBinaryFile(fn.GetFullPath()))
continue;
filteredFileList.Add( fn.GetFullPath() );
}
wxArrayString arrFiles;
// Clear the results once
{
// Before using the 'crawlerScan' we lock it, since it is not mt-safe
wxCriticalSectionLocker locker( TagsManagerST::Get()->m_crawlerLocker );
fcFileOpener::Instance()->ClearResults();
fcFileOpener::Instance()->ClearSearchPath();
for(size_t i=0; i<searchPaths.GetCount(); i++) {
const wxCharBuffer path = _C(searchPaths.Item(i));
DEBUG_MESSAGE( wxString::Format(wxT("ParseThread: Using Search Path: %s "), searchPaths.Item(i).c_str()) );
fcFileOpener::Instance()->AddSearchPath(path.data());
}
for(size_t i=0; i<excludePaths.GetCount(); i++) {
const wxCharBuffer path = _C(excludePaths.Item(i));
DEBUG_MESSAGE( wxString::Format(wxT("ParseThread: Using Exclude Path: %s "), excludePaths.Item(i).c_str()) );
fcFileOpener::Instance()->AddExcludePath(path.data());
}
for(size_t i=0; i<filteredFileList.GetCount(); i++) {
const wxCharBuffer cfile = filteredFileList.Item(i).mb_str(wxConvUTF8);
crawlerScan(cfile.data());
if( TestDestroy() ) {
return;
}
}
newSet->insert(fcFileOpener::Instance()->GetResults().begin(), fcFileOpener::Instance()->GetResults().end());
}
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:50,代码来源:parse_thread.cpp
注:本文中的wxCharBuffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论