5 #include <GG/adobe/array.hpp>
6 #include <GG/adobe/dictionary.hpp>
9 std::string read_file(
const std::string& filename)
12 std::ifstream ifs(filename.c_str());
14 while ((c = ifs.get()) != std::ifstream::traits_type::eof()) {
20 namespace adobe {
namespace version_1 {
22 std::ostream&
operator<<(std::ostream& stream,
const type_info_t& x)
24 std::ostream_iterator<char> out(stream);
31 void verbose_dump(
const adobe::array_t& array, std::size_t indent = 0);
32 void verbose_dump(
const adobe::dictionary_t& array, std::size_t indent = 0);
34 void verbose_dump(
const adobe::array_t& array, std::size_t indent)
37 std::cout << std::string(4 * indent,
' ') <<
"[]\n";
41 std::cout << std::string(4 * indent,
' ') <<
"[\n";
43 for (adobe::array_t::const_iterator it = array.begin(); it != array.end(); ++it) {
44 const adobe::any_regular_t& any = *it;
45 if (any.type_info() == adobe::type_info<adobe::array_t>()) {
46 verbose_dump(any.cast<adobe::array_t>(), indent);
47 }
else if (any.type_info() == adobe::type_info<adobe::dictionary_t>()) {
48 verbose_dump(any.cast<adobe::dictionary_t>(), indent);
50 std::cout << std::string(4 * indent,
' ')
51 <<
"type: " << any.type_info() <<
" "
52 <<
"value: " << any <<
"\n";
56 std::cout << std::string(4 * indent,
' ') <<
"]\n";
59 void verbose_dump(
const adobe::dictionary_t& dictionary, std::size_t indent)
61 if (dictionary.empty()) {
62 std::cout << std::string(4 * indent,
' ') <<
"{}\n";
66 std::cout << std::string(4 * indent,
' ') <<
"{\n";
68 for (adobe::dictionary_t::const_iterator it = dictionary.begin(); it != dictionary.end(); ++it) {
69 const adobe::pair<adobe::name_t, adobe::any_regular_t>& pair = *it;
70 if (pair.second.type_info() == adobe::type_info<adobe::array_t>()) {
71 std::cout << std::string(4 * indent,
' ') << pair.first <<
",\n";
72 verbose_dump(pair.second.cast<adobe::array_t>(), indent);
73 }
else if (pair.second.type_info() == adobe::type_info<adobe::dictionary_t>()) {
74 std::cout << std::string(4 * indent,
' ') << pair.first <<
",\n";
75 verbose_dump(pair.second.cast<adobe::dictionary_t>(), indent);
77 std::cout << std::string(4 * indent,
' ')
78 <<
"(" << pair.first <<
", "
79 <<
"type: " << pair.second.type_info() <<
" "
80 <<
"value: " << pair.second <<
")\n";
84 std::cout << std::string(4 * indent,
' ') <<
"}\n";