这篇教程C++ unescape_string函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中unescape_string函数的典型用法代码示例。如果您正苦于以下问题:C++ unescape_string函数的具体用法?C++ unescape_string怎么用?C++ unescape_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了unescape_string函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: add_magnet_uri torrent_handle add_magnet_uri(session& ses, std::string const& uri , add_torrent_params p, error_code& ec) { std::string name; std::string tracker; error_code e; boost::optional<std::string> display_name = url_has_argument(uri, "dn"); if (display_name) name = unescape_string(display_name->c_str(), e); boost::optional<std::string> tracker_string = url_has_argument(uri, "tr"); if (tracker_string) tracker = unescape_string(tracker_string->c_str(), e); boost::optional<std::string> btih = url_has_argument(uri, "xt"); if (!btih) { ec = error_code(errors::missing_info_hash_in_uri, libtorrent_category); return torrent_handle(); } if (btih->compare(0, 9, "urn:btih:") != 0) { ec = error_code(errors::missing_info_hash_in_uri, libtorrent_category); return torrent_handle(); } sha1_hash info_hash; if (btih->size() == 40 + 9) from_hex(&(*btih)[9], 40, (char*)&info_hash[0]); else info_hash.assign(base32decode(btih->substr(9))); if (!tracker.empty()) p.tracker_url = tracker.c_str(); p.info_hash = info_hash; if (!name.empty()) p.name = name.c_str(); return ses.add_torrent(p, ec); }
开发者ID:bgyss,项目名称:libtorrent,代码行数:34,
示例2: add_magnet_uri torrent_handle add_magnet_uri(session& ses, std::string const& uri , std::string const& save_path , storage_mode_t storage_mode , bool paused , storage_constructor_type sc , void* userdata) { std::string name; std::string tracker; error_code ec; std::string display_name = url_has_argument(uri, "dn"); if (!display_name.empty()) name = unescape_string(display_name.c_str(), ec); std::string tracker_string = url_has_argument(uri, "tr"); if (!tracker_string.empty()) tracker = unescape_string(tracker_string.c_str(), ec); std::string btih = url_has_argument(uri, "xt"); if (btih.empty()) return torrent_handle(); if (btih.compare(0, 9, "urn:btih:") != 0) return torrent_handle(); sha1_hash info_hash; if (btih.size() == 40 + 9) from_hex(&btih[9], 40, (char*)&info_hash[0]); else info_hash.assign(base32decode(btih.substr(9))); return ses.add_torrent(tracker.empty() ? 0 : tracker.c_str(), info_hash , name.empty() ? 0 : name.c_str(), save_path, entry() , storage_mode, paused, sc, userdata); }
开发者ID:bird1015,项目名称:avplayer,代码行数:29,
示例3: add_magnet_uri torrent_handle add_magnet_uri(session& ses, std::string const& uri , fs::path const& save_path , storage_mode_t storage_mode , bool paused , storage_constructor_type sc , void* userdata) { std::string name; std::string tracker; boost::optional<std::string> display_name = url_has_argument(uri, "dn"); if (display_name) name = unescape_string(display_name->c_str()); boost::optional<std::string> tracker_string = url_has_argument(uri, "tr"); if (tracker_string) tracker = unescape_string(tracker_string->c_str()); boost::optional<std::string> btih = url_has_argument(uri, "xt"); if (!btih) return torrent_handle(); if (btih->compare(0, 9, "urn:btih:") != 0) return torrent_handle(); sha1_hash info_hash; if (btih->size() == 40 + 9) info_hash = boost::lexical_cast<sha1_hash>(btih->substr(9)); else info_hash.assign(base32decode(btih->substr(9))); return ses.add_torrent(tracker.empty() ? 0 : tracker.c_str(), info_hash , name.empty() ? 0 : name.c_str(), save_path, entry() , storage_mode, paused, sc, userdata); }
开发者ID:huyang819,项目名称:cdn-partner,代码行数:28,
示例4: add_magnet_uri torrent_handle add_magnet_uri(session& ses, std::string const& uri , std::string const& save_path , storage_mode_t storage_mode , bool paused , storage_constructor_type sc , void* userdata) { add_torrent_params params(sc); params.storage_mode = storage_mode; params.userdata = userdata; params.save_path = save_path; if (paused) params.flags |= add_torrent_params::flag_paused; else params.flags &= ~add_torrent_params::flag_paused; error_code ec; std::string display_name = url_has_argument(uri, "dn"); if (!display_name.empty()) params.name = unescape_string(display_name.c_str(), ec); std::string tracker_string = url_has_argument(uri, "tr"); if (!tracker_string.empty()) params.trackers.push_back(unescape_string(tracker_string.c_str(), ec)); std::string btih = url_has_argument(uri, "xt"); if (btih.empty()) return torrent_handle(); if (btih.compare(0, 9, "urn:btih:") != 0) return torrent_handle(); if (btih.size() == 40 + 9) from_hex(&btih[9], 40, (char*)¶ms.info_hash[0]); else params.info_hash.assign(base32decode(btih.substr(9))); return ses.add_torrent(params); }
开发者ID:caisan,项目名称:libtorrent,代码行数:31,
示例5: unescape_stringTokenizerT *TKCreate(char *separators, char *ts) { /* * Description: creates a new tokenizer struct from the token stream and delimiters * Parameters: set of delimiters, token stream * Modifies: nothing * Returns: a pointer to a tokenizer struct on success, a null pointer on failure * */ if(separators == NULL || ts == NULL){ return NULL; } TokenizerT* tokenizer = (TokenizerT*)malloc(sizeof(TokenizerT)); if(tokenizer == NULL){ return NULL; } tokenizer->delimiters = unescape_string(separators); tokenizer->copied_string = unescape_string(ts); tokenizer->current_position = tokenizer->copied_string; return tokenizer;}
开发者ID:jonchen1,项目名称:indexer,代码行数:26,
示例6: convert_string_literalvoid convert_string_literal( const std::string &src, std::string &dest){ dest=""; assert(src.size()>=2); assert(src[0]=='"' || src[0]=='L'); assert(src[src.size()-1]=='"'); if(src[0]=='L') unescape_string(std::string(src, 2, src.size()-3), dest); else unescape_string(std::string(src, 1, src.size()-2), dest);}
开发者ID:huangshiyou,项目名称:esbmc,代码行数:15,
示例7: DBGconst string_ref *hstcpcli::get_next_row(){ if (num_flds == 0) { DBG(fprintf(stderr, "GNR NF 0/n")); return 0; } if (flds.size() < num_flds) { flds.resize(num_flds); } char *start = readbuf.begin() + cur_row_offset; char *const finish = readbuf.begin() + response_end_offset - 1; if (start >= finish) { /* start[0] == nl */ DBG(fprintf(stderr, "GNR FIN 0 %p %p/n", start, finish)); return 0; } for (size_t i = 0; i < num_flds; ++i) { skip_one(start, finish); char *const fld_begin = start; read_token(start, finish); char *const fld_end = start; char *wp = fld_begin; if (is_null_expression(fld_begin, fld_end)) { /* null */ flds[i] = string_ref(); } else { unescape_string(wp, fld_begin, fld_end); /* in-place */ flds[i] = string_ref(fld_begin, wp); } } cur_row_offset = start - readbuf.begin(); return &flds[0];}
开发者ID:AllenWeb,项目名称:mariadb,代码行数:33,
示例8: DBGconst string_ref *hstcpcli::get_next_row_from_result(hstresult& result){ if (result.num_flds == 0 || result.flds.elements < result.num_flds) { DBG(fprintf(stderr, "GNR NF 0/n")); return 0; } char *start = result.readbuf.begin() + result.cur_row_offset; char *const finish = result.readbuf.begin() + result.response_end_offset - 1; if (start >= finish) { /* start[0] == nl */ DBG(fprintf(stderr, "GNR FIN 0 %p %p/n", start, finish)); return 0; } for (size_t i = 0; i < result.num_flds; ++i) { skip_one(start, finish); char *const fld_begin = start; read_token(start, finish); char *const fld_end = start; char *wp = fld_begin; if (is_null_expression(fld_begin, fld_end)) { /* null */ ((string_ref *) result.flds.buffer)[i] = string_ref(); } else { unescape_string(wp, fld_begin, fld_end); /* in-place */ ((string_ref *) result.flds.buffer)[i] = string_ref(fld_begin, wp); } } result.cur_row_offset = start - result.readbuf.begin(); return (string_ref *) result.flds.buffer;}
开发者ID:SunguckLee,项目名称:MariaDB,代码行数:30,
示例9: ASSERT_IS_MAIN_THREADvoid history_t::add_with_file_detection(const wcstring &str){ ASSERT_IS_MAIN_THREAD(); path_list_t potential_paths; tokenizer tokenizer; for( tok_init( &tokenizer, str.c_str(), TOK_SQUASH_ERRORS ); tok_has_next( &tokenizer ); tok_next( &tokenizer ) ) { int type = tok_last_type( &tokenizer ); if (type == TOK_STRING) { const wchar_t *token_cstr = tok_last(&tokenizer); if (token_cstr) { wcstring potential_path = token_cstr; if (unescape_string(potential_path, false) && string_could_be_path(potential_path)) { potential_paths.push_front(potential_path); } } } } tok_destroy(&tokenizer); if (! potential_paths.empty()) { /* We have some paths. Make a context. */ file_detection_context_t *context = new file_detection_context_t(this, str); /* Store the potential paths. Reverse them to put them in the same order as in the command. */ potential_paths.reverse(); context->potential_paths.swap(potential_paths); iothread_perform(threaded_perform_file_detection, perform_file_detection_done, context); }}
开发者ID:ecraven,项目名称:fish-shell,代码行数:33,
示例10: expand_unescape_stringstatic wcstring expand_unescape_string(const wcstring &in, int escape_special){ wcstring tmp = in; unescape_string(tmp, escape_special); /* Need to detect error here */ return tmp;}
开发者ID:frogshead,项目名称:fish-shell,代码行数:7,
示例11: init_prop_string_with_escapestatic void init_prop_string_with_escape(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gchar * default_value){ *config_list = make_config_list_item(*config_list, pointer_to_var, 'e', name_of_var, 0); if (*(gchar **) pointer_to_var == NULL && default_value) { *(gchar **) pointer_to_var = unescape_string(default_value, FALSE); } DEBUG_MSG("init_prop_string, name_of_var=%s, default_value=%s/n", name_of_var, default_value);}
开发者ID:driedfruit,项目名称:barefish,代码行数:8,
示例12: preprocessor_linevoid preprocessor_line( const char *text, unsigned &line_no, irep_idt &file_name){ const char *ptr=text; std::string line_number; // skip WS while(*ptr==' ' || *ptr=='/t') ptr++; // skip # if(*ptr!='#') return; ptr++; // skip WS while(*ptr==' ' || *ptr=='/t') ptr++; // skip "line" if(*ptr=='l') { while(*ptr!=0 && *ptr!=' ' && *ptr!='/t') ptr++; } // skip WS while(*ptr==' ' || *ptr=='/t') ptr++; // get line number while(isdigit(*ptr)) { line_number+=*ptr; ptr++; } // skip until " while(*ptr!='/n' && *ptr!='"') ptr++; line_no=atoi(line_number.c_str()); // skip " if(*ptr!='"') return; ptr++; std::string file_name_tmp; // get file name while(*ptr!='/n' && *ptr!='"') { file_name_tmp+=*ptr; ptr++; } std::string file_name_tmp2; unescape_string(file_name_tmp, file_name_tmp2); file_name=file_name_tmp2;}
开发者ID:ericksonalves,项目名称:esbmc,代码行数:58,
示例13: preprocessor_linevoid preprocessor_line( const char *text, parsert &parser){ const char *ptr=text; std::string line_number; // skip WS while(*ptr==' ' || *ptr=='/t') ptr++; // skip # if(*ptr!='#') return; ptr++; // skip WS while(*ptr==' ' || *ptr=='/t') ptr++; // skip "line" if(*ptr=='l') { while(*ptr!=0 && *ptr!=' ' && *ptr!='/t') ptr++; } // skip WS while(*ptr==' ' || *ptr=='/t') ptr++; // get line number while(isdigit(*ptr)) { line_number+=*ptr; ptr++; } // skip until " while(*ptr!='/n' && *ptr!='"') ptr++; parser.set_line_no(unsafe_string2unsigned(line_number)); // skip " if(*ptr!='"') return; ptr++; std::string file_name_tmp; // get file name while(*ptr!='/n' && *ptr!='"') { file_name_tmp+=*ptr; ptr++; } std::string file_name_tmp2=unescape_string(file_name_tmp); parser.set_file(file_name_tmp2);}
开发者ID:danpoe,项目名称:cbmc,代码行数:57,
示例14: CharLiteral CharLiteral (Token _token, std::string _value) : Expression(_token, nullptr, Kind::CharLit, new BaseType(_token, "byte")) { _value = unescape_string(_value); if (_value.size() > 1) { // :( // TODO: error out. } else { value = _value[0]; } }
开发者ID:shamanas,项目名称:sky,代码行数:9,
示例15: escape_string void streamtools_object::test<18>() { std::string str; std::string expected_result; str = "SecondLife is a 3D world /n"; escape_string(str); expected_result = "SecondLife is a 3D world //n"; ensure_equals("escape_string: newline", str, expected_result); str = "SecondLife is a 3D world //t /n"; escape_string(str); expected_result = "SecondLife is a 3D world ////t //n"; ensure_equals("escape_string: backslash and newline", str, expected_result); str = "SecondLife is a 3D world /n /n /n ///n"; escape_string(str); expected_result = "SecondLife is a 3D world //n //n //n //////n"; ensure_equals("escape_string: multipel newline and backslash", str, expected_result); str = "SecondLife is a 3D world /t"; escape_string(str); expected_result = "SecondLife is a 3D world /t"; ensure_equals("unescape_string: leaves tab as is", str, expected_result); str = "/n"; escape_string(str); expected_result = "//n"; ensure_equals("unescape_string: only a newline", str, expected_result); // serialization/deserialization escape->unescape str = "SecondLife is a 3D world /n /n /n ///n"; escape_string(str); unescape_string(str); expected_result = "SecondLife is a 3D world /n /n /n ///n"; ensure_equals("escape_string: should preserve with escape/unescape", str, expected_result); // serialization/deserialization unescape->escape str = "SecondLife is a 3D world //n //n //n ////"; unescape_string(str); escape_string(str); expected_result = "SecondLife is a 3D world //n //n //n ////"; ensure_equals("escape_string: should preserve with unescape/escape", str, expected_result); }
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:44,
示例16: parse_section_startstatic dbus_bool_tparse_section_start (BusDesktopFileParser *parser, DBusError *error){ int line_end, eol_len; char *section_name; _DBUS_ASSERT_ERROR_IS_CLEAR (error); if (!_dbus_string_find_eol (&parser->data, parser->pos, &line_end, &eol_len)) line_end = parser->len; if (line_end - parser->pos <= 2 || _dbus_string_get_byte (&parser->data, line_end - 1) != ']') { report_error (parser, "Invalid syntax for section header", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, error); parser_free (parser); return FALSE; } section_name = unescape_string (parser, &parser->data, parser->pos + 1, line_end - 1, error); if (section_name == NULL) { parser_free (parser); return FALSE; } if (!is_valid_section_name (section_name)) { report_error (parser, "Invalid characters in section name", BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS, error); parser_free (parser); dbus_free (section_name); return FALSE; } if (open_section (parser, section_name) == NULL) { dbus_free (section_name); parser_free (parser); BUS_SET_OOM (error); return FALSE; } if (line_end == parser->len) parser->pos = parser->len; else parser->pos = line_end + eol_len; parser->line_num += 1; dbus_free (section_name); return TRUE;}
开发者ID:d-bus,项目名称:dbus,代码行数:56,
示例17: unescape_string void streamtools_object::test<17>() { std::string str; std::string expected_result; str = "SecondLife is a 3D world //n"; unescape_string(str); expected_result = "SecondLife is a 3D world /n"; ensure_equals("unescape_string: newline", str, expected_result); str = "SecondLife is a 3D world ////t //n"; unescape_string(str); expected_result = "SecondLife is a 3D world //t /n"; ensure_equals("unescape_string: backslash and newline", str, expected_result); str = "SecondLife is a 3D world // "; unescape_string(str); expected_result = "SecondLife is a 3D world // "; ensure_equals("unescape_string: insufficient to unescape", str, expected_result); str = "SecondLife is a 3D world //n //n //n //////n"; unescape_string(str); expected_result = "SecondLife is a 3D world /n /n /n ///n"; ensure_equals("unescape_string: multipel newline and backslash", str, expected_result); str = "SecondLife is a 3D world //t"; unescape_string(str); expected_result = "SecondLife is a 3D world //t"; ensure_equals("unescape_string: leaves tab as is", str, expected_result); str = "//n"; unescape_string(str); expected_result = "/n"; ensure_equals("unescape_string: only a newline", str, expected_result); }
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:35,
示例18: get_spad_outputvoidget_spad_output(FILE *pfile,char *command,int com_type){ int n, i; char buf[1024]; send_command(command, com_type); n = get_int(spad_socket); for (i = 0; i < n; i++) { get_string_buf(spad_socket, buf, 1024); fprintf(pfile, "%s/n", buf); } unescape_string(command);}
开发者ID:bfauser,项目名称:fricas,代码行数:14,
示例19: autosuggest_suggest_special/* We have to return an escaped string here */bool autosuggest_suggest_special(const wcstring &str, const wcstring &working_directory, wcstring &outSuggestion) { if (str.empty()) return false; ASSERT_IS_BACKGROUND_THREAD(); /* Parse the string */ wcstring parsed_command; wcstring_list_t parsed_arguments; int parsed_last_arg_pos = -1; if (! autosuggest_parse_command(str, &parsed_command, &parsed_arguments, &parsed_last_arg_pos)) return false; bool result = false; if (parsed_command == L"cd" && ! parsed_arguments.empty()) { /* We can possibly handle this specially */ const wcstring escaped_dir = parsed_arguments.back(); wcstring suggested_path; /* We always return true because we recognized the command. This prevents us from falling back to dumber algorithms; for example we won't suggest a non-directory for the cd command. */ result = true; outSuggestion.clear(); /* Unescape the parameter */ wcstring unescaped_dir = escaped_dir; bool unescaped = unescape_string(unescaped_dir, UNESCAPE_INCOMPLETE); /* Determine the quote type we got from the input directory. */ wchar_t quote = L'/0'; parse_util_get_parameter_info(escaped_dir, 0, "e, NULL, NULL); /* Big hack to avoid expanding a tilde inside quotes */ path_flags_t path_flags = (quote == L'/0') ? PATH_EXPAND_TILDE : 0; if (unescaped && is_potential_cd_path(unescaped_dir, working_directory, path_flags, &suggested_path)) { /* Note: this looks really wrong for strings that have an "unescapable" character in them, e.g. a /t, because parse_util_escape_string_with_quote will insert that character */ wcstring escaped_suggested_path = parse_util_escape_string_with_quote(suggested_path, quote); /* Return it */ outSuggestion = str; outSuggestion.erase(parsed_last_arg_pos); if (quote != L'/0') outSuggestion.push_back(quote); outSuggestion.append(escaped_suggested_path); if (quote != L'/0') outSuggestion.push_back(quote); } } else { /* Either an error or some other command, so we don't handle it specially */ } return result;}
开发者ID:fimmtiu,项目名称:fish-shell,代码行数:51,
示例20: c_decstatic chunk_t *c_dec(const chunk_t *inp){ char *s = tor_memdup_nulterm(inp->buf, inp->len); chunk_t *ch = tor_malloc(sizeof(chunk_t)); char *r = NULL; (void) unescape_string(s, &r, &ch->len); tor_free(s); ch->buf = (uint8_t*) r; if (!ch->buf) { tor_free(ch); } return ch;}
开发者ID:nmathewson,项目名称:Tor,代码行数:14,
示例21: whilestatic char *parse_key(const char **key, char *p, nx_json_unicode_encoder encoder) { // on '}' return with *p=='}' char c; while ((c = *p++)) { if (c == '"') { *key = unescape_string(p, &p, encoder); if (!*key) return 0; // propagate error while (*p && IS_WHITESPACE(*p)) p++; if (*p == ':') return p + 1; NX_JSON_REPORT_ERROR("unexpected chars", p); return 0; } else if (IS_WHITESPACE(c) || c == ',') { // continue } else if (c == '}') { return p - 1; } else if (c == '/') { if (*p == '/') { // line comment char *ps = p - 1; p = strchr(p + 1, '/n'); if (!p) { NX_JSON_REPORT_ERROR("endless comment", ps); return 0; // error } p++; } else if (*p == '*') { // block comment p = skip_block_comment(p + 1); if (!p) return 0; } else { NX_JSON_REPORT_ERROR("unexpected chars", p - 1); return 0; // error } } else { NX_JSON_REPORT_ERROR("unexpected chars", p - 1); return 0; // error } } NX_JSON_REPORT_ERROR("unexpected chars", p - 1); return 0; // error}
开发者ID:debosvi,项目名称:bozHMI,代码行数:49,
示例22: match/** Parse message msg */void env_universal_t::parse_message_internal(const wcstring &msgstr, var_table_t *vars, wcstring *storage){ const wchar_t *msg = msgstr.c_str(); // debug( 3, L"parse_message( %ls );", msg ); if (msg[0] == L'#') return; bool is_set_export = match(msg, SET_EXPORT_STR); bool is_set = ! is_set_export && match(msg, SET_STR); if (is_set || is_set_export) { const wchar_t *name, *tmp; const bool exportv = is_set_export; name = msg+(exportv?wcslen(SET_EXPORT_STR):wcslen(SET_STR)); while (name[0] == L'/t' || name[0] == L' ') name++; tmp = wcschr(name, L':'); if (tmp) { /* Use 'storage' to hold our key to avoid allocations */ storage->assign(name, tmp - name); const wcstring &key = *storage; wcstring val; if (unescape_string(tmp + 1, &val, 0)) { var_entry_t &entry = (*vars)[key]; entry.exportv = exportv; entry.val.swap(val); //acquire the value } } else { debug(1, PARSE_ERR, msg); } } else { debug(1, PARSE_ERR, msg); }}
开发者ID:hadoocn,项目名称:fish-shell,代码行数:48,
示例23: read_array/** Read lines of input from the specified file, unescape them and insert them into the specified list.*/static void read_array( FILE* file, wcstring_list_t &comp ){ std::vector<char> buffer; int c; wchar_t *wcs; while( !feof( file ) ) { buffer.clear(); while( 1 ) { c = getc( file ); if( c == EOF ) { break; } if( c == '/n' ) { break; } buffer.push_back(static_cast<char>(c)); } if( ! buffer.empty() ) { buffer.push_back(0); wcs = str2wcs( &buffer.at(0) ); if( wcs ) { wcstring tmp = wcs; if (unescape_string(tmp, 0)) { comp.push_back(tmp); } free( wcs ); } } }}
开发者ID:anbotero,项目名称:fish-shell,代码行数:48,
示例24: parse_device_idstatic gbooleanparse_device_id (const gchar * id, gchar ** sgname, int * inputIndex){ gchar ** parts; int numparts; GString * p1; GString * out1; int out2; out2 = 0; parts = g_strsplit (id, ":", -1); numparts = 0; while (parts[numparts]) ++numparts; /* must be exactly 1 or 2 parts */ if (numparts < 1 || numparts > 2) { g_strfreev (parts); return FALSE; } p1 = g_string_new (parts[0]); out1 = unescape_string (p1); g_string_free (p1, TRUE); if (numparts >= 2) { errno = 0; out2 = strtol (parts[1], NULL, 10); if (out2 == 0 && (errno == ERANGE || errno == EINVAL)) { g_string_free (out1, TRUE); g_strfreev (parts); return FALSE; } } g_strfreev (parts); *sgname = g_string_free (out1, FALSE); *inputIndex = out2; return TRUE;}
开发者ID:eta-im-dev,项目名称:media,代码行数:42,
示例25: parse_stringstatic bool parse_string(char *string, char **result){ int len = strlen(string); if (len < 2) { return false; } if (string[0] == TOK_DELIM_STR && string[len - 1] == TOK_DELIM_STR) { char *unescaped = unescape_string(string); if (!unescaped) { return false; } else { *result = unescaped; return true; } } else { return false; }}
开发者ID:k-stachowiak,项目名称:moon-lang,代码行数:21,
示例26: add_fieldstatic int add_field(HTable table, char *name, char *value, char *buf, long int *pos){ int value_type; char *s; HTable tbl; value_type = get_value_type(value); switch (value_type) { case TYPE_INT: table_set_int(table, name, atoi(value)); break; case TYPE_STRING: s = unescape_string(value); if (! s) return -1; table_set_str(table, name, s); free(s); break; case TYPE_FLOAT: table_set_double(table, name, atof(value)); break; case TYPE_TABLE: tbl = table_create(); if (table_set_table(table, name, tbl)) { table_free(tbl); return -1; } if (parse_table(tbl, buf, pos, 0)) return -1; break; default: return -1; } return 0;}
开发者ID:Oppen,项目名称:einstein,代码行数:37,
示例27: parse_section_startstatic gbooleanparse_section_start (GnomeThemeFileParser *parser, GError **error){ gchar *line_end; gchar *section_name; line_end = strchr (parser->line, '/n'); if (line_end == NULL) line_end = parser->line + strlen (parser->line); if (line_end - parser->line <= 2 || line_end[-1] != ']') { report_error (parser, "Invalid syntax for section header", GNOME_THEME_FILE_PARSE_ERROR_INVALID_SYNTAX, error); parser_free (parser); return FALSE; } section_name = unescape_string (parser->line + 1, line_end - parser->line - 2); if (section_name == NULL) { report_error (parser, "Invalid escaping in section name", GNOME_THEME_FILE_PARSE_ERROR_INVALID_ESCAPES, error); parser_free (parser); return FALSE; } open_section (parser, section_name); parser->line = (line_end) ? line_end + 1 : NULL; parser->line_nr++; g_free (section_name); return TRUE;}
开发者ID:DarkAngelII,项目名称:libgnomeui,代码行数:36,
示例28: parse_section_startstatic gbooleanparse_section_start (AnjutaPluginDescriptionParser *parser, GError **error){ gchar *line_end; gchar *section_name; line_end = strchr (parser->line, '/n'); if (line_end == NULL) line_end = parser->line + strlen (parser->line); if (line_end - parser->line <= 2 || line_end[-1] != ']') { report_error (parser, "Invalid syntax for section header", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX, error); parser_free (parser); return FALSE; } section_name = unescape_string (parser->line + 1, line_end - parser->line - 2); if (section_name == NULL) { report_error (parser, "Invalid escaping in section name", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_ESCAPES, error); parser_free (parser); return FALSE; } open_section (parser, section_name); parser->line = (line_end) ? line_end + 1 : NULL; parser->line_nr++; g_free (section_name); return TRUE;}
开发者ID:weynhamz,项目名称:GNOME-anjuta,代码行数:36,
示例29: builtin_complete//.........这里部分代码省略......... break; switch (opt) { case 0: if (long_options[opt_index].flag != 0) break; append_format(stderr_buffer, BUILTIN_ERR_UNKNOWN, argv[0], long_options[opt_index].name); builtin_print_help(parser, argv[0], stderr_buffer); res = true; break; case 'x': result_mode |= EXCLUSIVE; break; case 'f': result_mode |= NO_FILES; break; case 'r': result_mode |= NO_COMMON; break; case 'p': case 'c': { wcstring tmp; if (unescape_string(woptarg, &tmp, UNESCAPE_SPECIAL)) { if (opt=='p') path.push_back(tmp); else cmd.push_back(tmp); } else { append_format(stderr_buffer, L"%ls: Invalid token '%ls'/n", argv[0], woptarg); res = true; } break; } case 'd': desc = woptarg; break; case 'u': authoritative=0; break; case 'A': authoritative=1; break; case 's': short_opt.append(woptarg); break; case 'l': gnu_opt.push_back(woptarg);
开发者ID:ThomasRooney,项目名称:fish-shell,代码行数:67,
注:本文中的unescape_string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ unexec_error函数代码示例 C++ unescape函数代码示例 |