本文整理汇总了C++中quote函数的典型用法代码示例。如果您正苦于以下问题:C++ quote函数的具体用法?C++ quote怎么用?C++ quote使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quote函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: show_utf8
static void show_utf8(FILE *f, const char *text, const char *pre, const char *post, int is_attribute)
{
int len;
if (!text)
return;
while (isspace(*text))
text++;
len = strlen(text);
if (!len)
return;
while (len && isspace(text[len-1]))
len--;
/* FIXME! Quoting! */
fputs(pre, f);
quote(f, text, is_attribute);
fputs(post, f);
}
示例2: makedir
static int makedir(const string& name, std::ostream& msg, bool user_only = false)
{
StreamAction action(msg, "Creating " + quote(name + "/"));
mode_t mask = umask(0);
umask(mask);
mode_t mode;
if (user_only)
mode = S_IRWXU & ~mask;
else
mode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~mask;
int ret = mkdir(name.chars(), mode);
if (ret != 0)
action.failed(strerror(errno));
return ret;
}
示例3: xheader_set_keyword_equal
static void
xheader_set_keyword_equal (char *kw, char *eq)
{
bool global = true;
char *p = eq;
if (eq[-1] == ':')
{
p--;
global = false;
}
while (p > kw && isspace ((unsigned char) *p))
p--;
*p = 0;
for (p = eq + 1; *p && isspace ((unsigned char) *p); p++)
;
if (strcmp (kw, "delete") == 0)
{
if (xheader_protected_pattern_p (p))
USAGE_ERROR ((0, 0, _("Pattern %s cannot be used"), quote (p)));
xheader_list_append (&keyword_pattern_list, p, NULL);
}
else if (strcmp (kw, "exthdr.name") == 0)
assign_string (&exthdr_name, p);
else if (strcmp (kw, "globexthdr.name") == 0)
assign_string (&globexthdr_name, p);
else if (strcmp (kw, "exthdr.mtime") == 0)
assign_time_option (&exthdr_mtime_option, &exthdr_mtime, p);
else if (strcmp (kw, "globexthdr.mtime") == 0)
assign_time_option (&globexthdr_mtime_option, &globexthdr_mtime, p);
else
{
if (xheader_protected_keyword_p (kw))
USAGE_ERROR ((0, 0, _("Keyword %s cannot be overridden"), kw));
if (global)
xheader_list_append (&keyword_global_override_list, kw, p);
else
xheader_list_append (&keyword_override_list, kw, p);
}
}
示例4: compute_output_file_names
void
compute_output_file_names (void)
{
char const *name[4];
int i;
int j;
int names = 0;
compute_file_name_parts ();
/* If not yet done. */
if (!src_extension)
src_extension = ".c";
if (!header_extension)
header_extension = ".h";
name[names++] = parser_file_name =
spec_outfile ? spec_outfile : concat2 (all_but_ext, src_extension);
if (defines_flag)
{
if (! spec_defines_file)
spec_defines_file = concat2 (all_but_ext, header_extension);
name[names++] = spec_defines_file;
}
if (graph_flag)
{
if (! spec_graph_file)
spec_graph_file = concat2 (all_but_tab_ext, ".vcg");
name[names++] = spec_graph_file;
}
if (report_flag)
{
spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
name[names++] = spec_verbose_file;
}
for (j = 0; j < names; j++)
for (i = 0; i < j; i++)
if (strcmp (name[i], name[j]) == 0)
warn (_("conflicting outputs to file %s"), quote (name[i]));
}
示例5: SaveTipCountCB
static void SaveTipCountCB(Widget, XtPointer = 0, XtPointer = 0)
{
create_session_dir(DEFAULT_SESSION);
const string file = session_tips_file();
std::ofstream os(file.chars());
os <<
"! " DDD_NAME " tips file\n"
"\n"
<< app_value(XtNstartupTipCount,
itostring(++app_data.startup_tip_count)) << "\n";
os.close();
if (os.bad())
{
post_error("Cannot save tip count in " + quote(file),
"options_save_error");
}
}
示例6: muscle_percent_define_insert
void
muscle_percent_define_insert (char const *var, location variable_loc,
muscle_kind kind,
char const *value,
muscle_percent_define_how how)
{
/* Backward compatibility. */
char *variable = muscle_percent_variable_update (var, variable_loc, &value);
uniqstr name = muscle_name (variable, NULL);
uniqstr loc_name = muscle_name (variable, "loc");
uniqstr syncline_name = muscle_name (variable, "syncline");
uniqstr how_name = muscle_name (variable, "how");
uniqstr kind_name = muscle_name (variable, "kind");
/* Command-line options are processed before the grammar file. */
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
&& muscle_find_const (name))
{
muscle_percent_define_how how_old = atoi (muscle_find_const (how_name));
unsigned i = 0;
if (how_old == MUSCLE_PERCENT_DEFINE_F)
goto end;
complain_indent (&variable_loc, complaint, &i,
_("%%define variable %s redefined"),
quote (variable));
i += SUB_INDENT;
location loc = muscle_percent_define_get_loc (variable);
complain_indent (&loc, complaint, &i, _("previous definition"));
}
MUSCLE_INSERT_STRING (name, value);
muscle_insert (loc_name, "");
muscle_location_grow (loc_name, variable_loc);
muscle_insert (syncline_name, "");
muscle_syncline_grow (syncline_name, variable_loc);
muscle_user_name_list_grow ("percent_define_user_variables", variable,
variable_loc);
MUSCLE_INSERT_INT (how_name, how);
MUSCLE_INSERT_STRING (kind_name, muscle_kind_string (kind));
end:
free (variable);
}
示例7: gdbChangeDirectoryDCB
// ChangeDirectory program with given arguments
static void gdbChangeDirectoryDCB(Widget, XtPointer, XtPointer)
{
Widget text = XmSelectionBoxGetChild(cd_dialog, XmDIALOG_TEXT);
String _args = XmTextGetString(text);
string args(_args);
XtFree(_args);
string path = source_view->full_path(args);
switch (gdb->type()) {
case PERL:
gdb_command("chdir " + quote(path, '\''));
break;
case BASH:
gdb_command("eval cd " + path);
break;
default:
gdb_command("cd " + path);
}
}
示例8: addBrackets
// Reformulate explicit user constraint so it matches the format of the constraint parser
string ConstraintFomatter::consToFormula(const Model & model, const CompID ID)
{
string formula; // Resulting formula specifying all the constraints
formula = "tt";
for (const string constraint : model.components[ID].constraints)
{
try
{
formula.append(" & " + addBrackets(formatConstraint(constraint, model, ID)));
}
catch (exception & e)
{
throw runtime_error("Error while parsing the constraint: " + quote(constraint) + ". " + e.what());
}
}
return addBrackets(formula);
}
示例9: dump_rec
void dump_rec(const char* var, int i, struct initrec* p)
{
char** a;
printf("static struct initrec %s%i = {\n", var, i);
printf("\t.name = %s,\n", quote(p->name));
printf("\t.rlvl = %i,\n", p->rlvl);
printf("\t.flags = %i,\n", p->flags);
printf("\t.pid = %i,\n", p->pid);
printf("\t.lastrun = %li,\n", (long)p->lastrun);
printf("\t.lastsig = %li,\n", (long)p->lastsig);
printf("\t.argv = { ");
for(a = p->argv; *a; a++)
// no quoting for now
printf("\"%s\", ", *a);
printf(" NULL }\n");
printf("};\n");
}
示例10: start_graph
void
start_graph (FILE *fout)
{
fprintf (fout,
_("// Generated by %s.\n"
"// Report bugs to <%s>.\n"
"// Home page: <%s>.\n"
"\n"),
PACKAGE_STRING,
PACKAGE_BUGREPORT,
PACKAGE_URL);
fprintf (fout,
"digraph %s\n"
"{\n",
quote (grammar_file));
fprintf (fout,
" node [fontname = courier, shape = box, colorscheme = paired6]\n"
" edge [fontname = courier]\n"
"\n");
}
示例11: Urn
bool
ClientImpl::sync_upload(
std::string remote_file,
std::string local_file,
callback_t callback,
progress_t progress
) noexcept
{
bool is_existed = FileInfo::exists(local_file);
if (!is_existed) return false;
auto root_urn = Urn(this->webdav_root, true);
auto file_urn = root_urn + remote_file;
std::ifstream file_stream(local_file, std::ios::binary);
auto size = FileInfo::size(local_file);
Request request(this->options());
auto url = this->webdav_hostname + file_urn.quote(request.handle);
Data response = { 0, 0, 0 };
request.set(CURLOPT_UPLOAD, 1L);
request.set(CURLOPT_URL, url.c_str());
request.set(CURLOPT_READDATA, (size_t)&file_stream);
request.set(CURLOPT_READFUNCTION, (size_t)Callback::Read::stream);
request.set(CURLOPT_INFILESIZE_LARGE, (curl_off_t)size);
request.set(CURLOPT_BUFFERSIZE, (long)Client::buffer_size);
request.set(CURLOPT_WRITEDATA, (size_t)&response);
request.set(CURLOPT_WRITEFUNCTION, (size_t)Callback::Append::buffer);
if (progress != nullptr) {
request.set(CURLOPT_XFERINFOFUNCTION, (size_t)progress.target<progress_funptr>());
request.set(CURLOPT_NOPROGRESS, 0L);
}
bool is_performed = request.perform();
if (callback != nullptr) callback(is_performed);
return is_performed;
}
示例12: love_album
static int
love_album(struct mpdcron_connection *conn, bool love, const char *expr)
{
int changes;
char *esc_album, *myexpr;
struct mpd_song *song;
if (expr != NULL) {
if (!mpdcron_love_album_expr(conn, love, expr, &changes)) {
eulog(LOG_ERR, "Failed to %s album: %s",
love ? "love" : "hate",
conn->error->message);
return 1;
}
}
else {
if ((song = load_current_song()) == NULL)
return 1;
else if (mpd_song_get_tag(song, MPD_TAG_ALBUM, 0) == NULL) {
eulog(LOG_ERR, "Current playing song has no album tag!");
mpd_song_free(song);
return 1;
}
esc_album = quote(mpd_song_get_tag(song, MPD_TAG_ALBUM, 0));
myexpr = g_strdup_printf("name=%s", esc_album);
g_free(esc_album);
mpd_song_free(song);
if (!mpdcron_love_album_expr(conn, love, myexpr, &changes)) {
eulog(LOG_ERR, "Failed to %s current playing album: %s",
love ? "love" : "hate",
conn->error->message);
g_free(myexpr);
return 1;
}
g_free(myexpr);
}
printf("Modified %d entries\n", changes);
return 0;
}
示例13: query
bool PostgreAdapter::update(std::string table_I, std::map<std::string, std::string> attributes_I, std::map<std::string, std::string> where_I)
{
std::ostringstream query("");
query
<< "UPDATE "
<< table_I
<< " SET ";
for (auto& it: attributes_I) {
if (it != *attributes_I.begin())
query << ", ";
query
<< it.first
<< " = "
<< quote(it.second);
}
query << makeWhere(where_I);
return tryQuery(query.str());
}
示例14: addModifier
void CChemEqInterface::addModifier(const std::string & name)
{
std::pair< std::string, std::string > Modifier =
CMetabNameInterface::splitDisplayName(name);
//is the name already in the list
std::vector< std::string >::const_iterator it, itEnd = mModifierNames.end();
std::vector< std::string >::const_iterator itComp = mModifierCompartments.begin();
for (it = mModifierNames.begin(); it != itEnd; ++it, ++itComp)
if (Modifier.first == *it &&
Modifier.second == *itComp) break;
if (it == itEnd)
{
mModifierNames.push_back(Modifier.first);
mModifierMult.push_back(1.0);
mModifierCompartments.push_back(Modifier.second);
mModifierDisplayNames.push_back(quote(name));
}
}
示例15: QString
bool BrowserFlow::undelete(bool, QString & warning, QString & renamed)
{
if (! deletedp())
return FALSE;
if (def->get_start_node()->deletedp() ||
def->get_end_node()->deletedp()) {
warning += QString("<li><b>") + quote(name) + "</b> " + TR("from") + " <b>" +
def->get_start_node()->full_name() +
"</b> " + TR("to") + " <b>" + def->get_end_node()->full_name() + "</b>\n";
return FALSE;
}
is_deleted = FALSE;
def->undelete(warning, renamed);
package_modified();
repaint();
return TRUE;
}