Example #1
0
    std::string process_ids(id_state& state, std::string const& xml)
    {
        placeholder_index placeholders = index_placeholders(state, xml);

        typedef std::vector<id_placeholder*>::iterator iterator;

        iterator it = placeholders.begin(),
            end = placeholders.end();

        // Placeholder ids are processed in blocks of ids with
        // an equal number of dots.
        while (it != end) {
            unsigned num_dots = (*it)->num_dots;

            // ids can't clash with ids at a different num_dots, so
            // this only needs to track the id generation data
            // for a single num_dots at a time.
            allocated_ids ids;

            iterator it2 = it;
            do {
                resolve_id(**it2++, ids);
            } while(it2 != end && (*it2)->num_dots == num_dots);

            do {
                generate_id(**it++, ids);
            } while(it != it2);
        }

        return replace_ids(state, xml);
    }
Example #2
0
 std::string document_state::replace_placeholders(boost::string_ref xml) const
 {
     assert(!state->current_file);
     std::vector<std::string> ids = generate_ids(*state, xml);
     return replace_ids(*state, xml, &ids);
 }
Example #3
0
 std::string id_manager::replace_placeholders_with_unresolved_ids(
         std::string const& xml) const
 {
     return replace_ids(*state, xml, false);
 }
Example #4
0
 std::string document_state::replace_placeholders_with_unresolved_ids(
         boost::string_ref xml) const
 {
     return replace_ids(*state, xml);
 }