예제 #1
0
파일: main.cpp 프로젝트: andrusha97/dynamic
    void
    operator()(const dynamic_t::object_t& v) {
        ++m_objects;

        for (auto it = v.begin(); it != v.end(); ++it) {
            it->second.apply(*this);
        }
    }
예제 #2
0
파일: main.cpp 프로젝트: andrusha97/dynamic
    void
    operator()(const dynamic_t::object_t& v) const {
        std::cout << "{" << std::endl;

        bool print_coma = false;
        for(auto it = v.begin(); it != v.end(); ++it) {
            if (print_coma) {
                std::cout << "," << std::endl;
            }
            std::cout << std::string(2 * (m_indent + 1), ' ') << "'" << it->first << "': ";
            it->second.apply(print_visitor(m_indent + 1));
            print_coma = true;
        }

        std::cout << std::endl << std::string(2 * m_indent, ' ') << "}";
    }
예제 #3
0
    std::string
    operator()(const dynamic_t::object_t& v) const {
        std::string result = "{";

        dynamic_t::object_t::const_iterator it = v.begin();

        if(it != v.end()) {
            result += "\"" + it->first + "\":" + it->second.apply(*this);
            ++it;
        }

        for(; it != v.end(); ++it) {
            result += ", ";
            result += "\"" + it->first + "\":" + it->second.apply(*this);
        }

        return result + "}";
    }