本文整理汇总了C++中glib::ustring类的典型用法代码示例。如果您正苦于以下问题:C++ ustring类的具体用法?C++ ustring怎么用?C++ ustring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ustring类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set_skin
void Gxmetal_ampGUI::set_skin()
{
Glib::ustring toparse = "pixmap_path ";
toparse += " '";
toparse += GX_LV2_STYLE_DIR;
toparse += "/'\n";
toparse += "style \"gx_";
toparse += plug_name;
toparse += "_dark-paintbox\"\n"
" { \n"
"GxPaintBox::skin-gradient = {\n"
"{ 65536, 0, 0, 13107, 52428 }, \n"
"{ 52428, 0, 0, 0, 52428 },\n"
"{ 13107, 0, 0, 13107, 13107 }}\n"
" GxPaintBox::icon-set =4\n"
" stock['amp_skin'] = {{'";
toparse += plugskin;
toparse += "'}}\n"
" }\n"
"\n"
"style 'gx_headmetal_amp_box' \n"
" { \n"
" fg[NORMAL] = '#cbc8c8' \n"
"font_name = 'sans bold 9.5' \n"
" }\n";
toparse += addKnob;
toparse += " widget '*.amplabel' style:highest 'gx_headmetal_amp_box'\n"
"widget '*.";
toparse += plug_name;
toparse += "' style 'gx_";
toparse += plug_name;
toparse += "_dark-paintbox' ";
toparse += "style 'gx_switch'\n"
"{\n"
"xthickness = 0\n"
"ythickness = 0\n"
"GtkButton::inner-border = {0, 0, 0, 0}\n"
"GtkButton::default-border = {0, 0, 0, 0}\n"
"GtkButton::focus-line-width = 0\n"
"GtkButton::focus-padding = 0\n"
"GtkButton::interior-focus = 0\n"
"GtkButton::child-displacement-x = 0\n"
"GtkButton::child-displacement-y = 0\n"
" }\n"
"widget '*.";
toparse += plug_name;
toparse += "' style:highest 'gx_switch'";
gtk_rc_parse_string (toparse.c_str());
}
开发者ID:dafx,项目名称:guitarix,代码行数:51,代码来源:gxmetal_amp_gui.cpp
示例2: switch
Glib::ustring
get_file_save_path (SPDocument *doc, FileSaveMethod method) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Glib::ustring path;
bool use_current_dir = true;
switch (method) {
case FILE_SAVE_METHOD_SAVE_AS:
{
use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true);
if (doc->getURI() && use_current_dir) {
path = Glib::path_get_dirname(doc->getURI());
} else {
path = prefs->getString("/dialogs/save_as/path");
}
break;
}
case FILE_SAVE_METHOD_TEMPORARY:
path = prefs->getString("/dialogs/save_as/path");
break;
case FILE_SAVE_METHOD_SAVE_COPY:
use_current_dir = prefs->getBool("/dialogs/save_copy/use_current_dir", prefs->getBool("/dialogs/save_as/use_current_dir", true));
if (doc->getURI() && use_current_dir) {
path = Glib::path_get_dirname(doc->getURI());
} else {
path = prefs->getString("/dialogs/save_copy/path");
}
break;
case FILE_SAVE_METHOD_INKSCAPE_SVG:
if (doc->getURI()) {
path = Glib::path_get_dirname(doc->getURI());
} else {
// FIXME: should we use the save_as path here or something else? Maybe we should
// leave this as a choice to the user.
path = prefs->getString("/dialogs/save_as/path");
}
break;
case FILE_SAVE_METHOD_EXPORT:
/// \todo no default path set for Export?
// defaults to g_get_home_dir()
break;
}
if(path.empty()) {
path = g_get_home_dir(); // Is this the most sensible solution? Note that we should avoid
// g_get_current_dir because this leads to problems on OS X where
// Inkscape opens the dialog inside application bundle when it is
// invoked for the first teim.
}
return path;
}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:51,代码来源:system.cpp
示例3: tokenizeWords
void tokenizeWords(const Glib::ustring& str, std::vector<Glib::ustring>& container)
{
ustring::size_type lastPos = str.find_first_not_of(' ', 0);
ustring::size_type pos = str.find_first_of(' ', lastPos);
while (ustring::npos != pos || ustring::npos != lastPos)
{
container.push_back(str.substr(lastPos, pos - lastPos));
lastPos = str.find_first_not_of(' ', pos);
pos = str.find_first_of(' ', lastPos);
}
}
开发者ID:WizardGed,项目名称:lostirc,代码行数:14,代码来源:Utils.cpp
示例4: bHasSuffix
bool bHasSuffix(const Glib::ustring & _rsString,
const Glib::ustring & _rsSuffix,
bool _bCaseSensitive)
{
if (_rsSuffix.size() > _rsString.size())
{
return false;
}
Glib::ustring sEnd = _rsString.substr(_rsString.size() - _rsSuffix.size());
if (_bCaseSensitive)
{
if (_rsSuffix == sEnd)
{
return true;
}
}
else
{
if (_rsSuffix.lowercase() == sEnd.lowercase())
{
return true;
}
}
return false;
}
开发者ID:bgK,项目名称:vba-ttb,代码行数:28,代码来源:Tools.cpp
示例5: delete_note
void NoteDirectoryWatcherApplicationAddin::delete_note(const Glib::ustring & note_id)
{
DBG_OUT("NoteDirectoryWatcher: deleting %s because file deleted.", note_id.c_str());
Glib::ustring note_uri = make_uri(note_id);
gnote::NoteBase::Ptr note_to_delete = note_manager().find_by_uri(note_uri);
if(note_to_delete != 0) {
note_manager().delete_note(note_to_delete);
}
else {
DBG_OUT("notedirectorywatcher: did not delete %s because note not found.", note_id.c_str());
}
}
开发者ID:mattiklock,项目名称:gnote,代码行数:14,代码来源:notedirectorywatcherapplicationaddin.cpp
示例6: strlen
virtual void on_end_element (
Glib::Markup::ParseContext& context,
const Glib::ustring& element)
{
if (Glib::str_has_prefix (text_, "<![CDATA[") &&
Glib::str_has_suffix (text_, "]]>")) {
text_ = text_.substr (strlen ("<![CDATA["),
text_.length () - strlen ("<![CDATA[" "]]>"));
}
if (element == "doi") {
bib_.setDoi (text_);
} else if (element == "article_title") {
bib_.setTitle (text_);
/* FIXME: assuming given_name precedes surname */
} else if (element == "given_name") {
given_name_ = text_;
} else if (element == "surname") {
if (!given_name_.empty()) {
text_ = text_ + ", " + given_name_;
given_name_ = "";
}
authors_.push_back (text_);
} else if (element == "journal_title") {
bib_.setJournal (text_);
} else if (element == "volume") {
bib_.setVolume (text_);
} else if (element == "issue") {
bib_.setIssue (text_);
} else if (element == "first_page") {
bib_.setPages (text_);
} else if (element == "year") {
bib_.setYear (text_);
} else if (element == "volume_title") {
bib_.addExtra ("BookTitle", text_);
} else if (element == "body") {
/* End of entry */
Glib::ustring authorString;
std::vector<Glib::ustring>::iterator it = authors_.begin ();
for (; it != authors_.end(); ++it) {
if (it != authors_.begin()) {
authorString += " and ";
}
authorString += *it;
}
if (!authorString.empty())
bib_.setAuthors (authorString);
}
}
开发者ID:egroeper,项目名称:referencer,代码行数:49,代码来源:CrossRefPlugin.C
示例7: on_server_apply
void Settings::on_server_apply() {
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_list_servers->get_selection();
Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
if(!iter) {
return;
}
Gtk::TreeModel::Row row = *iter;
if(m_server_detail_server->is_sensitive()) {
row[m_Columns.m_hostname] = m_server_detail_server->get_text();
}
if(m_server_detail_aet->is_sensitive()) {
row[m_Columns.m_aet] = m_server_detail_aet->get_text();
}
if(m_server_detail_port->is_sensitive()) {
guint i = atoi(m_server_detail_port->get_text().c_str());
row[m_Columns.m_port] = i;
}
if(m_server_detail_group->is_sensitive()) {
row[m_Columns.m_group] = m_server_detail_group->get_entry()->get_text();
}
if(m_server_detail_description->is_sensitive()) {
Glib::ustring desc = m_server_detail_description->get_text();
row[m_Columns.m_name] = desc;
if(desc.empty()) {
m_settings_ok->set_sensitive(false);
}
else {
m_settings_ok->set_sensitive(true);
}
}
if(m_server_detail_lossy->is_sensitive()) {
row[m_Columns.m_lossy] = m_server_detail_lossy->get_active();
}
if(m_server_detail_relational->is_sensitive()) {
row[m_Columns.m_relational] = m_server_detail_relational->get_active();
}
// enable echo button
if(!m_server_detail_aet->get_text().empty() &&
!m_server_detail_server->get_text().empty() &&
!m_server_detail_port->get_text().empty()) {
m_server_detail_echo->set_sensitive(true);
}
else {
m_server_detail_echo->set_sensitive(false);
}
}
开发者ID:hsanjuan,项目名称:aeskulap,代码行数:49,代码来源:settings.cpp
示例8: onSearchEqual
/*
* Search function for widget.
* Returns true if entered text matches contact address or nickname.
*/
bool ContactsTreeWidget::onSearchEqual(const Glib::RefPtr<Gtk::TreeModel>& model, gint column, const Glib::ustring& key, const Gtk::TreeModel::iterator& iter) {
Gtk::TreeModel::Row row = *iter;
if (row[columns.contactIndex] >= 20 && row[columns.contactIndex] != GROUP_INDEX_NOT_AUTHORIZED) {
Glib::ustring x;
x = row[columns.contactAddress];
if (x.find(key) != Glib::ustring::npos) {
return false;
}
x = row[columns.contactNickname];
if (x.find(key) != Glib::ustring::npos) {
return false;
}
}
return true;
}
开发者ID:hamzehpourahmad,项目名称:swift-im,代码行数:19,代码来源:ContactsTreeWidget.cpp
示例9: extractNodeName
std::string ParserXML::extractNodeName (const xmlpp::Node* node) const
{
const xmlpp::TextNode* nodeText = dynamic_cast<const xmlpp::TextNode*> (node);
const xmlpp::CommentNode* nodeComment = dynamic_cast<const xmlpp::CommentNode*> (node);
std::string readLine = "";
Glib::ustring nodename = node->get_name ();
if (nodeText && (nodeText->is_white_space () || nodeText->get_content () == ""))
return "";
if (!nodeText && !nodeComment && !nodename.empty ())
readLine = node->get_name ();
return (readLine);
}
开发者ID:LittleWhite-tb,项目名称:microperf,代码行数:15,代码来源:ParserXML.cpp
示例10: push_data
bool post_office::push_data (Glib::ustring data) {
if(connected)
{
/* Send the word to the server */
int len = strlen(data.c_str());
if (send(sock, data.c_str(), len, 0) != len) {
this->set_last_error("Mismatch in number of sent bytes");
return false;
}
return true;
}
this->set_last_error("Not connected");
return false;
}
开发者ID:BackupTheBerlios,项目名称:lapucapu,代码行数:15,代码来源:post_office.cpp
示例11: new_open__
//#ifdef ver_3_
void new_open__(const Glib::ustring& url,WebKitWebView* wwv){
Glib::ustring js;
js=
"var a=document.createElement('a');"//_x
"a.setAttribute('href','"+url+"');"
"a.setAttribute('target','_blank');"
//"a.innerHTML='a';"
//"var body=document.getElementsByTagName('body')[0];"
//"body.appendChild(a);"
"var me=document.createEvent('MouseEvents');"
"me.initEvent('click',true,false);"
"a.dispatchEvent(me);"
;
webkit_web_view_execute_script (wwv, js.c_str());
}
开发者ID:BGCX261,项目名称:zhscript-svn-to-git,代码行数:16,代码来源:control___.cpp
示例12: ManglerAudio
void
ManglerAudio::playText(Glib::ustring text) {/*{{{*/
if (!text.length() || !Mangler::config["NotificationTextToSpeech"].toBool()) {
return;
}
#ifdef HAVE_ESPEAK
espeak_SetSynthCallback(espeak_synth_cb);
ManglerAudio *tts = new ManglerAudio(AUDIO_NOTIFY, mangler->espeakRate, 1, 0, 0, false);
if (espeak_Synth(text.c_str(), text.length() + 1, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, tts) != EE_OK) {
tts->finish();
fprintf(stderr, "espeak: synth error\n");
return;
}
#endif
}/*}}}*/
开发者ID:Isanderthul,项目名称:mangler,代码行数:15,代码来源:mangleraudio.cpp
示例13: print_button_clicked
void PrintNotesNoteAddin::print_button_clicked(const Glib::VariantBase&)
{
try {
m_print_op = Gtk::PrintOperation::create();
m_print_op->set_job_name(get_note()->get_title());
Glib::RefPtr<Gtk::PrintSettings> settings = Gtk::PrintSettings::create();
Glib::ustring dir = Glib::get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
if (dir.empty()) {
dir = Glib::get_home_dir();
}
Glib::ustring ext;
if (settings->get(Gtk::PrintSettings::Keys::OUTPUT_FILE_FORMAT) == "ps") {
ext = ".ps";
}
else {
ext = ".pdf";
}
Glib::ustring uri = "file://";
uri += dir + "/gnotes" + ext;
settings->set (Gtk::PrintSettings::Keys::OUTPUT_URI, uri);
m_print_op->set_print_settings (settings);
m_print_op->signal_begin_print().connect(
sigc::mem_fun(*this, &PrintNotesNoteAddin::on_begin_print));
m_print_op->signal_draw_page().connect(
sigc::mem_fun(*this, &PrintNotesNoteAddin::on_draw_page));
m_print_op->signal_end_print().connect(
sigc::mem_fun(*this, &PrintNotesNoteAddin::on_end_print));
m_print_op->run(Gtk::PRINT_OPERATION_ACTION_PRINT_DIALOG, *get_host_window());
}
catch (const sharp::Exception & e)
{
DBG_OUT("Exception while printing %s: %s", get_note()->get_title().c_str(),
e.what());
gnote::utils::HIGMessageDialog dlg(get_host_window(),
GTK_DIALOG_MODAL,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
_("Error printing note"),
e.what());
dlg.run ();
}
m_print_op.clear(); // yeah I really mean clear the pointer.
}
开发者ID:mattiklock,项目名称:gnote,代码行数:48,代码来源:printnotesnoteaddin.cpp
示例14: fprintf
bool
ManglerAlsa::open(int type, Glib::ustring device, int rate, int channels) {/*{{{*/
if ((alsa_error = snd_pcm_open(
&alsa_stream,
(device == "") ? "default" : device.c_str(),
(type >= AUDIO_OUTPUT) ? SND_PCM_STREAM_PLAYBACK : SND_PCM_STREAM_CAPTURE,
0)) < 0) {
fprintf(stderr, "alsa: snd_pcm_open() failed: %s\n", snd_strerror(alsa_error));
alsa_stream = NULL;
return false;
}
if ((alsa_error = snd_pcm_set_params(
alsa_stream, // pcm handle
SND_PCM_FORMAT_S16_LE, // format
SND_PCM_ACCESS_RW_INTERLEAVED, // access
channels, // channels
rate, // rate
true, // soft_resample
150000)) < 0) { // latency in usec (0.15 sec)
fprintf(stderr, "alsa: snd_pcm_set_params() failed: %s\n", snd_strerror(alsa_error));
close();
return false;
}
if ((alsa_error = snd_pcm_prepare(alsa_stream)) < 0) {
fprintf(stderr, "alsa: snd_pcm_prepare() failed: %s\n", snd_strerror(alsa_error));
close();
return false;
}
if (type == AUDIO_INPUT && (alsa_error = snd_pcm_start(alsa_stream)) < 0) {
fprintf(stderr, "alsa: snd_pcm_start() failed: %s\n", snd_strerror(alsa_error));
close();
return false;
}
return true;
}/*}}}*/
开发者ID:prometheanfire,项目名称:mangler,代码行数:35,代码来源:mangleralsa.cpp
示例15: show
void CalligraphicProfileRename::show(SPDesktop *desktop, const Glib::ustring profile_name)
{
CalligraphicProfileRename &dial = instance();
dial._applied=false;
dial._deleted=false;
dial.set_modal(true);
dial._profile_name = profile_name;
dial._profile_name_entry.set_text(profile_name);
if (profile_name.empty()) {
dial.set_title(_("Add profile"));
dial._delete_button.set_visible(false);
} else {
dial.set_title(_("Edit profile"));
dial._delete_button.set_visible(true);
}
desktop->setWindowTransient (dial.gobj());
dial.property_destroy_with_parent() = true;
// dial.Gtk::Dialog::show();
//dial.present();
dial.run();
}
开发者ID:AakashDabas,项目名称:inkscape,代码行数:25,代码来源:calligraphic-profile-rename.cpp
示例16: update_read
/* Callback for receiving data from modem */
void Terminal::update_read(Glib::ustring data)
{
size_t iReplyOem;
size_t iddot;
size_t replyOemLen = strlen(this->modem->REPLY_OEM().c_str());
if(!data.is_ascii())
REMOVE_NON_ASCII(data);
inputPortBuffer += data;
while(!inputPortBuffer.empty()) {
iReplyOem = inputPortBuffer.find(this->modem->REPLY_OEM());
iddot = inputPortBuffer.find(":");
if(iReplyOem == std::string::npos && iddot == std::string::npos)
return;
if(iReplyOem < iddot) {
input.push(inputPortBuffer.substr(0, iReplyOem));
inputPortBuffer.erase(0, iReplyOem + replyOemLen);
}
else {
input.push(inputPortBuffer.substr(0, iddot+1)); /* 1 == strlen(":") */
inputPortBuffer.erase(0, iddot + 1); /* 1 == strlen(":") */
}
}
}
开发者ID:abyoussef,项目名称:X-CubeSat,代码行数:28,代码来源:terminal.cpp
示例17: set_charset
/* compressed utf-8 table */
0x20ac, /* 80 Euro. CP1252 from here on... */
0x81, /* 81 NA */
0x201a, /* 82 */
0x192, /* 83 */
0x201e, /* 84 */
0x2026, /* 85 */
0x2020, /* 86 */
0x2021, /* 87 */
0x2c6, /* 88 */
0x2030, /* 89 */
0x160, /* 8a */
0x2039, /* 8b */
0x152, /* 8c */
0x8d, /* 8d NA */
0x17d, /* 8e */
0x8f, /* 8f NA */
0x90, /* 90 NA */
0x2018, /* 91 */
0x2019, /* 92 */
0x201c, /* 93 */
0x201d, /* 94 */
0x2022, /* 95 */
0x2013, /* 96 */
0x2014, /* 97 */
0x2dc, /* 98 */
0x2122, /* 99 */
0x161, /* 9a */
0x203a, /* 9b */
0x153, /* 9c */
0x9d, /* 9d NA */
0x17e, /* 9e */
0x178, /* 9f */
0xa0, /* a0 */
0xa1, /* a1 */
0xa2, /* a2 */
0xa3, /* a3 */
0x20ac /* a4 ISO-8859-15 Euro. */
};
while (len) {
if (G_UNLIKELY(*text >= 0x80) && G_UNLIKELY(*text <= 0xa4)) {
int idx = *text - 0x80;
output += lowtable[idx];
} else {
output += (gunichar)*text; /* ascii/iso88591 maps directly */
}
text++;
len--;
}
return output;
}/*}}}*/
void set_charset(Glib::ustring charset) {/*{{{*/
charset = charset.uppercase();
if (charset.find(' ') != Glib::ustring::npos)
charset = charset.erase(charset.find(' '));
if (charset.empty() || !charset.compare("SYSTEM")) {
charset.clear();
} else {
try {
Glib::IConv test("UTF-8", charset);
} catch (...) {
fprintf(stderr, "Charset '%s' isn't supported by your system - using system locale\n", charset.c_str());
charset.clear();
}
}
serverCharset = charset;
}/*}}}*/
std::string ustring_to_c(Glib::ustring input) {/*{{{*/
std::string to_charset, converted;
// check if input is already 7-bit
if (input.is_ascii())
return input;
// try encoding using the selected charset, unless its some utf-8
if (!serverCharset.empty() && serverCharset.find("UTF-8") == Glib::ustring::npos) {
try {
return Glib::convert(input, serverCharset, "UTF-8");
} catch (...) {}
}
// try encoding using the locale charset, unless its some utf-8
if (Glib::get_charset(to_charset) == true)
to_charset = "ISO-8859-1";
try {
converted = Glib::convert_with_fallback(input, to_charset, "UTF-8", "?");
} catch (...) {
converted = input;
}
return converted;
}/*}}}*/
Glib::ustring c_to_ustring(const char *input) {/*{{{*/
Glib::ustring converted, input_u;
// if input is NULL, return an empty string
//.........这里部分代码省略.........
开发者ID:Isanderthul,项目名称:mangler,代码行数:101,代码来源:manglercharset.cpp
示例18:
void
TextParam::param_setValue(const Glib::ustring newvalue)
{
value = newvalue;
sp_canvastext_set_text (canvas_text, newvalue.c_str());
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:7,代码来源:text.cpp
示例19: main
int main (int argc, char **argv)
{
Glib::thread_init();
Gtk::Main kit(argc, argv);
Glib::ustring ces = argv[0];
Glib::ustring::size_type vzd = ces.rfind("/");
ces = Glib::ustring(ces.c_str(), ces.c_str()+vzd);
int a = chdir(ces.c_str());
if(a != 0){
std::cerr<<"ERROR chdir: "<<a<<std::endl;
}
Okno *Hl = new Okno();
delete Hl;
return 0;
}
开发者ID:martingt89,项目名称:Onibo-converter,代码行数:16,代码来源:main.cpp
示例20: parse_number
unsigned long XGPacketBuilder::parse_number(Glib::ustring str)
{
unsigned long l = 0;
size_t n = str.find("0x");
if (n != std::string::npos)
{
l = std::strtol(str.substr(n).c_str(), 0, 16);
}
else
{
l = std::strtol(str.c_str(), 0, 10);
}
return l;
}
开发者ID:alexforencich,项目名称:xgrid,代码行数:16,代码来源:XGPacketBuilder.cpp
注:本文中的glib::ustring类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论