本文整理汇总了C++中save_string函数的典型用法代码示例。如果您正苦于以下问题:C++ save_string函数的具体用法?C++ save_string怎么用?C++ save_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_ident
void RelationData::save(QTextStream & st, bool ref, QString & warning) const
{
if (ref)
st << "relation_ref " << get_ident() << " // " << (name);
else {
nl_indent(st);
st << "relation " << get_ident() << " " << stringify(type);
if (name != default_name(type)) {
st << " name ";
save_string(name, st);
}
indent(+1);
BasicData::save(st, warning);
if (original_id != 0) {
nl_indent(st);
st << "oid " << original_id;
}
bool assoc = isa_association(type);
nl_indent(st);
indent(+1);
st << "a ";
save_role(a, assoc, st, warning);
start->save(st, TRUE, warning);
indent(-1);
nl_indent(st);
indent(+1);
st << "b";
if (!RelationData::uni_directional(type)) {
st << " ";
save_role(b, assoc, st, warning);
end->save(st, TRUE, warning);
}
else {
if (!b.multiplicity.isEmpty()) {
st << " multiplicity ";
save_string(b.multiplicity, st);
}
st << " parent ";
end_removed_from->save(st, TRUE, warning);
}
indent(-1);
if ((association.type != 0) || !association.explicit_type.isEmpty()) {
nl_indent(st);
association.save(st, warning, "association_type ", "association_explicit_type ");
}
indent(-1);
}
}
开发者ID:harmegnies,项目名称:douml,代码行数:60,代码来源:RelationData.cpp
示例2: save_presets
void save_presets(int do_update)
{
FILE *f=fopen("powder.def", "wb");
unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66};
unsigned char tmp = sdl_scale;
if(!f)
return;
fwrite(sig, 1, 4, f);
save_string(f, svf_user);
save_string(f, svf_pass);
fwrite(&tmp, 1, 1, f);
tmp = cmode;
fwrite(&tmp, 1, 1, f);
tmp = svf_admin;
fwrite(&tmp, 1, 1, f);
tmp = svf_mod;
fwrite(&tmp, 1, 1, f);
save_string(f, http_proxy_string);
tmp = SAVE_VERSION;
fwrite(&tmp, 1, 1, f);
tmp = MINOR_VERSION;
fwrite(&tmp, 1, 1, f);
tmp = do_update;
fwrite(&tmp, 1, 1, f);
fclose(f);
}
开发者ID:7soccerbo7,项目名称:The-Powder-Toy,代码行数:26,代码来源:misc.c
示例3: st
void Tool::save()
{
QByteArray newdef;
Q3TextStream st(newdef, QIODevice::WriteOnly);
st.setEncoding(Q3TextStream::Latin1);
st << "// 'tool' \"the executable\" \"displayed string\" {target}+";
for (unsigned rank = 0; rank != ntools; rank += 1) {
ATool & tool = tools[rank];
st << "\ntool ";
save_string(tools[rank].display, st);
st << ' ';
save_string(tools[rank].cmd, st);
for (int index = 0; index != sizeof(ToolCase) / sizeof(*ToolCase); index += 1) {
if (tool.applicable[ToolCase[index].kind]) {
st << ' ' << ToolCase[index].key;
}
}
}
st << '\n';
st << '\000';
save_if_needed("tools", newdef);
}
开发者ID:SciBoy,项目名称:douml,代码行数:28,代码来源:Tool.cpp
示例4: pcePPReference
char *
pcePPReference(PceObject ref)
{ if ( isInteger(ref) )
{ Any addr = longToPointer(valInt(ref));
char *rval = pp(addr);
if ( rval[0] != '@' )
{ char tmp[256];
sprintf(tmp, "@" INTPTR_FORMAT, valInt(ref));
return save_string(tmp);
} else
return rval;
} else if ( isName(ref) )
{ Any addr;
if ( !(addr = getObjectAssoc(ref)) )
{ char tmp[256];
sprintf(tmp, "@%s", strName(ref));
return save_string(tmp);
} else
return pp(addr);
} else
return save_string("invalid reference");
}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:25,代码来源:interface.c
示例5: get_ident
void CodDirsCanvas::save(QTextStream & st, bool ref, QString & warning) const
{
if (ref)
st << "dirscanvas_ref " << get_ident();
else {
nl_indent(st);
st << "dirscanvas " << get_ident() << " z " << zValue() << " ";
link->save(st, TRUE, warning);
indent(+1);
settings.save_msg(st);
if (label != 0) {
nl_indent(st);
st << "forward_label ";
save_string(label->get_name().toLatin1().constData(), st);
save_xyz(st, label, " xyz");
}
if (backward_label != 0) {
nl_indent(st);
st << "backward_label ";
save_string(backward_label->get_name().toLatin1().constData(), st);
save_xyz(st, backward_label, " xyz");
}
indent(-1);
}
}
开发者ID:kennyams,项目名称:douml,代码行数:30,代码来源:CodDirsCanvas.cpp
示例6: newdef
void Tool::save()
{
QSharedPointer<QByteArray> newdef(new QByteArray());
QTextStream st(newdef.data(), QIODevice::WriteOnly);
//st.setEncoding(QTextStream::Latin1);
st.setCodec(QTextCodec::codecForName("latin1"));
st << "// 'tool' \"the executable\" \"displayed string\" {target}+";
for (unsigned rank = 0; rank != ntools; rank += 1) {
ATool & tool = tools[rank];
st << "\ntool ";
save_string(tools[rank].display.toLatin1().constData(), st);
st << " ";
save_string(tools[rank].cmd.toLatin1().constData(), st);
for (int index = 0; index != sizeof(ToolCase) / sizeof(*ToolCase); index += 1) {
if (tool.applicable[ToolCase[index].kind]) {
st << " " << ToolCase[index].key;
}
}
}
st << '\n';
st << '\000';
st.flush();
save_if_needed("tools", newdef);
}
开发者ID:gilbertoca,项目名称:douml,代码行数:30,代码来源:Tool.cpp
示例7: main
int main (void) {
PageManager* pm = new_page_manager(".");
printf("I Made my pm\n");
printf("My index path is: %s\n", pm->index_path);
RawPage* new_page = new_data_page(pm);
printf("new page fd is %d at memory addr %p\n", new_page->fd, new_page->page);
// Save some strings
PageRef* str_1 = save_string(new_page, "Hello There");
PageRef* str_2 = save_string(new_page, "I am a second string");
printf("Before unload page\n");
unload_page(new_page);
printf("After unloda page\n");
// load some strings
load_string(pm, str_1);
load_string(pm, str_2);
//make our tree page
RawPage* t_page = new_tree_page(pm);
TreeNode* test_node = malloc(sizeof(TreeNode));
memset(test_node, 0, sizeof(TreeNode));
test_node->size = 0;
test_node->order = 2;
test_node->num_leaves = 0;
test_node->parent.page_type = 0xDE110;
test_node->parent.page_num = 31337;
test_node->parent.node_offset = 31337;
PageRef* node1 = save_node(t_page, test_node);
unload_page(t_page);
load_node(pm, node1);
}
开发者ID:TravisWhitaker,项目名称:SKV,代码行数:31,代码来源:test_thing_derp.c
示例8: cvtchar
static int
cvtchar(register const char *sp)
/* convert a character to a terminfo push */
{
unsigned char c = 0;
int len;
switch (*sp) {
case '\\':
switch (*++sp) {
case '\'':
case '$':
case '\\':
case '%':
c = *sp;
len = 2;
break;
case '\0':
c = '\\';
len = 1;
break;
case '0':
case '1':
case '2':
case '3':
len = 1;
while (isdigit(UChar(*sp))) {
c = 8 * c + (*sp++ - '0');
len++;
}
break;
default:
c = *sp;
len = 2;
break;
}
break;
case '^':
c = (*++sp & 0x1f);
len = 2;
break;
default:
c = *sp;
len = 1;
}
if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') {
dp = save_string(dp, "%\'");
dp = save_char(dp, c);
dp = save_char(dp, '\'');
} else {
dp = save_string(dp, "%{");
if (c > 99)
dp = save_char(dp, c / 100 + '0');
if (c > 9)
dp = save_char(dp, ((int) (c / 10)) % 10 + '0');
dp = save_char(dp, c % 10 + '0');
dp = save_char(dp, '}');
}
return len;
}
开发者ID:ipwndev,项目名称:DSLinux-Mirror,代码行数:60,代码来源:captoinfo.c
示例9: emit_structure
def_t *
emit_structure (const char *name, int su, struct_def_t *defs, type_t *type,
void *data, storage_class_t storage)
{
int i, j;
int saw_null = 0;
int saw_func = 0;
symbol_t *struct_sym;
symbol_t *field_sym;
def_t *struct_def;
def_t field_def;
name = save_string (name);
if (!type)
type = make_structure (0, su, defs, 0)->type;
if (!is_struct (type) || (su == 's' && type->meta != ty_struct)
|| (su == 'u' && type->meta != ty_union))
internal_error (0, "structure %s type mismatch", name);
for (i = 0, field_sym = type->t.symtab->symbols; field_sym;
i++, field_sym = field_sym->next) {
if (!defs[i].name)
internal_error (0, "structure %s unexpected end of defs", name);
if (field_sym->type != defs[i].type)
internal_error (0, "structure %s.%s field type mismatch", name,
defs[i].name);
if ((!defs[i].emit && saw_func) || (defs[i].emit && saw_null))
internal_error (0, "structure %s mixed emit/copy", name);
if (!defs[i].emit)
saw_null = 1;
if (defs[i].emit)
saw_func = 1;
}
if (defs[i].name)
internal_error (0, "structure %s too many defs", name);
if (storage != sc_global && storage != sc_static)
internal_error (0, "structure %s must be global or static", name);
struct_sym = make_symbol (name, type, pr.far_data, storage);
struct_def = struct_sym->s.def;
if (struct_def->initialized)
internal_error (0, "structure %s already initialized", name);
struct_def->initialized = struct_def->constant = 1;
struct_def->nosave = 1;
for (i = 0, field_sym = type->t.symtab->symbols; field_sym;
i++, field_sym = field_sym->next) {
field_def.type = field_sym->type;
field_def.name = save_string (va ("%s.%s", name, field_sym->name));
field_def.space = struct_def->space;
field_def.offset = struct_def->offset + field_sym->s.offset;
if (!defs[i].emit) {
//FIXME relocs? arrays? structs?
pr_type_t *val = (pr_type_t *) data;
memcpy (D_POINTER (void, &field_def), val,
type_size (field_def.type) * sizeof (pr_type_t));
data = &val[type_size (field_def.type)];
} else {
if (is_array (field_def.type)) {
开发者ID:EIREXE,项目名称:Quakeforge-gcw0,代码行数:59,代码来源:struct.c
示例10: save_string
int C_THISCLASS::save_config(unsigned char *data)
{
int pos=0;
data[pos++]=1;
save_string(data,pos,effect_exp[0]);
save_string(data,pos,effect_exp[1]);
save_string(data,pos,effect_exp[2]);
PUT_INT(blend); pos+=4;
PUT_INT(subpixel); pos+=4;
return pos;
}
开发者ID:azeem,项目名称:chavs,代码行数:11,代码来源:r_shift.cpp
示例11: nl_indent
void ParamData::save(QTextStream & st, QString & warning) const
{
nl_indent(st);
st << " param " << stringify(dir) << " name ";
save_string(name, st);
type.save(st, warning, " type ", " explicit_type ");
if (!default_value.isEmpty()) {
nl_indent(st);
st << " defaultvalue ";
save_string(default_value, st);
}
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:13,代码来源:ParamData.cpp
示例12: nl_indent
void HaveKeyValueData::save(Q3TextStream & st) const {
if (nkeyvalues) {
nl_indent(st);
st << "ncouples " << nkeyvalues;
for (unsigned i = 0; i != nkeyvalues; i += 1) {
nl_indent(st);
st << "key ";
save_string(keyvalues[i].get_key(), st);
st << " value ";
save_string(keyvalues[i].get_value(), st);
}
}
}
开发者ID:SciBoy,项目名称:douml,代码行数:14,代码来源:HaveKeyValueData.cpp
示例13: nl_indent
void BasicData::save(Q3TextStream & st, QString &) const {
if (! stereotype.isEmpty()) {
nl_indent(st);
st << "stereotype ";
save_string(stereotype, st);
}
}
开发者ID:SciBoy,项目名称:douml,代码行数:7,代码来源:BasicData.cpp
示例14: try_pk
bool
try_pk (string family, int size, int dpi, int dsize,
tex_font_metric& tfm, font_glyphs& pk)
{
// cout << "Try pk " << family << size << " at " << dpi << " dpi\n";
#ifdef USE_FREETYPE
// Substitute by True Type font ?
int tt_size= size<333? size: (size+50)/100;
int tt_dpi = size<333? dpi : (size * dpi) / (100 * tt_size);
string tt_name= tt_find_name (family, tt_size);
if (tt_name != "") {
if (font_glyphs::instances -> contains (tt_name))
pk= font_glyphs (tt_name);
else pk= tt_font_glyphs (tt_name, tt_size, tt_dpi);
return true;
}
#endif // USE_FREETYPE
// Open regular pk font
string name_pk= family * as_string (size) * "." * as_string (dpi) * "pk";
if (font_glyphs::instances -> contains (name_pk)) {
pk = font_glyphs (name_pk);
return true;
}
if (dsize == 0) {
int old_size= size;
size= tfm->size;
dpi = mag (dpi, old_size, size);
}
string size_name (dsize==0? string (""): as_string (size));
string name (family * size_name * "." * as_string (dpi) * "pk");
if (DEBUG_STD) debug_fonts << "Open pk " << name << "\n";
url u= resolve_tex (name);
if (is_none (u)) {
if (exists (url ("$TEXMACS_HOME_PATH/fonts/error", name))) {
if (DEBUG_STD)
debug_fonts << "Error during " << name << " loading\n";
return false;
}
if (get_setting ("MAKEPK") != "false") {
system_wait ("Generating font file", name);
make_tex_pk (family * size_name, dpi, as_int (get_setting ("DPI")));
system_wait ("");
u= resolve_tex (name);
if (is_none (u)) {
reset_pk_path ();
u= resolve_tex (name);
}
}
if (is_none (u)) {
save_string (url ("$TEXMACS_HOME_PATH/fonts/error", name), "");
if (DEBUG_STD)
debug_fonts << "Error during " << name << " loading\n";
return false;
}
}
pk = font_glyphs (tm_new<pk_font_glyphs_rep> (name_pk,
tm_new<pk_loader> (u, tfm, dpi)));
return true;
}
开发者ID:niujiashu,项目名称:texmacs-mirror,代码行数:60,代码来源:load_tex.cpp
示例15: prepare_path_for_write
void filestorage::save_string(t_filestore file_type,
const std::string &filename,
const std::string &data,
bool overwrite) {
if (filename == "") {
throw std::invalid_argument("Fail to open file for write: empty filename");
}
fs::path file_with_path;
try {
file_with_path = prepare_path_for_write(file_type, filename, overwrite);
fs::ofstream file(file_with_path, std::ios::out | std::ios::binary);
if (file.is_open()) {
file << data;
} else {
throw std::invalid_argument("Fail to open file for write: " + filename);
}
file.close();
_dbg2("Successfully saved string to:" << file_with_path.native());
} catch(overwrite_error &err) {
std::cout << err.what() << std::endl;
if(text_ui::ask_user_forpermission("overwrite file?")){
save_string(file_type, filename, data, true);
} else {
_dbg2("Fail to save string");
}
}
}
开发者ID:tigusoft-vm,项目名称:antinet-before-yedino,代码行数:32,代码来源:filestorage.cpp
示例16: setup_texmacs
void
setup_texmacs () {
url settings_file= "$TEXMACS_HOME_PATH/system/settings.scm";
debug_boot << "Welcome to TeXmacs " TEXMACS_VERSION "\n";
debug_boot << HRULE;
set_setting ("VERSION", TEXMACS_VERSION);
setup_tex ();
setup_inkscape_extension ();
string s= scheme_tree_to_block (texmacs_settings);
//cout << "settings_t= " << texmacs_settings << "\n";
//cout << "settings_s= " << s << "\n";
if (save_string (settings_file, s) || load_string (settings_file, s, false)) {
failed_error << HRULE;
failed_error << "I could not save or reload the file\n\n";
failed_error << "\t" << settings_file << "\n\n";
failed_error << "Please give me full access control over this file and\n";
failed_error << "rerun 'TeXmacs'.\n";
failed_error << HRULE;
FAILED ("unable to write settings");
}
debug_boot << HRULE;
debug_boot << "Installation completed successfully !\n";
debug_boot << "I will now start up the editor\n";
debug_boot << HRULE;
}
开发者ID:xywei,项目名称:texmacs,代码行数:28,代码来源:init_texmacs.cpp
示例17: save_stringc
static void
save_stringc(struct uih_context *uih, const char *name, const char *param)
{
start_save(uih, name);
save_string(uih, param);
stop_save(uih);
}
开发者ID:Azizou,项目名称:XaoS,代码行数:7,代码来源:save.c
示例18: cache_save
void
cache_save (string buffer) {
if (cache_changed->contains (buffer)) {
url cache_file= texmacs_home_path * url ("system/cache/" * buffer);
string cached;
iterator<tree> it= iterate (cache_data);
if (buffer == "file_cache" || buffer == "doc_cache") {
while (it->busy ()) {
tree ckey= it->next ();
if (ckey[0] == buffer) {
cached << ckey[1]->label << "\n";
cached << cache_data [ckey]->label << "\n";
cached << "%-%-tm-cache-%-%\n";
}
}
}
else {
cached << "(tuple\n";
while (it->busy ()) {
tree ckey= it->next ();
if (ckey[0] == buffer) {
cached << tree_to_scheme (ckey[1]) << " ";
cached << tree_to_scheme (cache_data [ckey]) << "\n";
}
}
cached << ")";
}
(void) save_string (cache_file, cached);
cache_changed->remove (buffer);
}
}
开发者ID:svn2github,项目名称:texmacs,代码行数:31,代码来源:data_cache.cpp
示例19: void
void Settings::SaveToFile(std::ostream &os, void (*save_string)(std::ostream &os, const std::string &s)) const
{
for (int i = 0; i < number_of_fields; ++i)
{
save_string( os, get_names(i) );
}
}
开发者ID:asavan,项目名称:rec_qml,代码行数:7,代码来源:Settings.cpp
示例20: get_ident
void DeploymentNodeCanvas::save(Q3TextStream & st, bool ref, QString & warning) const {
if (ref)
st << "deploymentnodecanvas_ref " << get_ident() << " // " << browser_node->get_name();
else {
nl_indent(st);
st << "deploymentnodecanvas " << get_ident() << ' ';
indent(+1);
browser_node->save(st, TRUE, warning);
if (!iname.isEmpty()) {
nl_indent(st);
st << "name ";
save_string(iname, st);
}
nl_indent(st);
if (write_horizontally != UmlDefaultState)
st << "write_horizontally " << stringify(write_horizontally) << ' ';
if (show_stereotype_properties != UmlDefaultState)
st << "show_stereotype_properties " << stringify(show_stereotype_properties) << ' ';
if (itscolor != UmlDefaultColor)
st << "color " << stringify(itscolor) << ' ';
save_xyzwh(st, this, "xyzwh");
save_stereotype_property(st, warning);
indent(-1);
nl_indent(st);
st << "end";
}
}
开发者ID:SciBoy,项目名称:douml,代码行数:27,代码来源:DeploymentNodeCanvas.cpp
注:本文中的save_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论