OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [util/] [common_type/] [assoc/] [string_form.hpp] - Blame information for rev 746

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// -*- C++ -*-
2
 
3
// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the terms
7
// of the GNU General Public License as published by the Free Software
8
// Foundation; either version 3, or (at your option) any later
9
// version.
10
 
11
// This library is distributed in the hope that it will be useful, but
12
// WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
// General Public License for more details.
15
 
16
// You should have received a copy of the GNU General Public License
17
// along with this library; see the file COPYING3.  If not see
18
// <http://www.gnu.org/licenses/>.
19
 
20
 
21
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
22
 
23
// Permission to use, copy, modify, sell, and distribute this software
24
// is hereby granted without fee, provided that the above copyright
25
// notice appears in all copies, and that both that copyright notice
26
// and this permission notice appear in supporting documentation. None
27
// of the above authors, nor IBM Haifa Research Laboratories, make any
28
// representation about the suitability of this software for any
29
// purpose. It is provided "as is" without express or implied
30
// warranty.
31
 
32
/**
33
 * @file string_form.hpp
34
 * Transforms containers into string form.
35
 */
36
 
37
#ifndef PB_DS_STRING_FORM_HPP
38
#define PB_DS_STRING_FORM_HPP
39
 
40
#include <string>
41
#include <sstream>
42
#include <ext/pb_ds/detail/type_utils.hpp>
43
#include <ext/pb_ds/tag_and_trait.hpp>
44
#include <native_type/native_hash_map.hpp>
45
#include <native_type/native_hash_set.hpp>
46
#include <native_type/native_multimap.hpp>
47
#include <native_type/native_hash_multimap.hpp>
48
#include <native_type/native_set.hpp>
49
#include <common_type/assoc/template_policy.hpp>
50
#include <common_type/assoc/detail/ds_string_form.hpp>
51
#include <regression/basic_type.hpp>
52
#include <io/xml.hpp>
53
 
54
namespace __gnu_pbds
55
{
56
  namespace test
57
  {
58
    namespace detail
59
    {
60
      template<typename Cntnr>
61
      struct pb_ds_string_form
62
      {
63
      private:
64
        typedef typename Cntnr::mapped_type mapped_type;
65
 
66
        struct mapped_string_form
67
        {
68
        private:
69
          template<typename D_Cntnr>
70
          static std::string
71
          name(D_Cntnr)
72
          { return ("mmap_" + pb_ds_string_form<D_Cntnr>::name()); }
73
 
74
          template<typename D_Cntnr>
75
          static std::string
76
          desc(D_Cntnr)
77
          { return pb_ds_string_form<D_Cntnr>::desc(); }
78
 
79
          static std::string
80
          name(size_t)
81
          { return ("map"); }
82
 
83
          static std::string
84
          desc(size_t)
85
          { return (""); }
86
 
87
          static std::string
88
          name(basic_type)
89
          { return ("map"); }
90
 
91
          static std::string
92
          desc(basic_type)
93
          { return (""); }
94
 
95
          static std::string
96
          name(int)
97
          { return ("map"); }
98
 
99
          static std::string
100
          desc(int)
101
          { return (""); }
102
 
103
          static std::string
104
          name(char)
105
          { return ("map"); }
106
 
107
          static std::string
108
          desc(char)
109
          { return (""); }
110
 
111
          static std::string
112
          name(__gnu_pbds::null_type)
113
          { return ("set"); }
114
 
115
          static std::string
116
          desc(__gnu_pbds::null_type)
117
          { return (""); }
118
 
119
        public:
120
          static std::string
121
          name()
122
          { return name(mapped_type()); }
123
 
124
          static std::string
125
          desc()
126
          { return desc(mapped_type()); }
127
        };
128
 
129
        typedef
130
        detail::ds_string_form<Cntnr, typename Cntnr::container_category>
131
        ds_string_form_t;
132
 
133
      public:
134
        static std::string
135
        name()
136
        { return (ds_string_form_t::name() + mapped_string_form::name()); }
137
 
138
        static std::string
139
        desc()
140
        { return (ds_string_form_t::desc() + mapped_string_form::desc()); }
141
      };
142
 
143
      template<typename Cntnr>
144
      struct native_string_form
145
      {
146
        static std::string
147
        name()
148
        { return Cntnr::name(); }
149
 
150
        static std::string
151
        desc()
152
        { return Cntnr::desc(); }
153
      };
154
 
155
      template<typename Cntnr, class Tag>
156
      struct tag_select_string_form : public pb_ds_string_form<Cntnr>
157
      { };
158
 
159
      template<typename Cntnr>
160
      struct tag_select_string_form<Cntnr, native_hash_tag>
161
      : public native_string_form<Cntnr>
162
      { };
163
 
164
      template<typename Cntnr>
165
      struct tag_select_string_form<Cntnr, native_tree_tag>
166
      : public native_string_form<Cntnr>
167
      { };
168
    } // namespace detail
169
 
170
    template<typename Cntnr>
171
    struct string_form
172
    : public detail::tag_select_string_form<Cntnr,
173
                                            typename Cntnr::container_category>
174
    { };
175
  } // namespace test
176
} // namespace __gnu_pbds
177
 
178
#endif
179
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.