Blame src/subset_map.hpp

Packit Service 7770af
#ifndef SASS_SUBSET_MAP_H
Packit Service 7770af
#define SASS_SUBSET_MAP_H
Packit Service 7770af
Packit Service 7770af
#include <map>
Packit Service 7770af
#include <set>
Packit Service 7770af
#include <vector>
Packit Service 7770af
#include <algorithm>
Packit Service 7770af
#include <iterator>
Packit Service 7770af
Packit Service 7770af
#include "ast_fwd_decl.hpp"
Packit Service 7770af
Packit Service 7770af
Packit Service 7770af
// #include <iostream>
Packit Service 7770af
// #include <sstream>
Packit Service 7770af
// template<typename T>
Packit Service 7770af
// std::string vector_to_string(std::vector<T> v)
Packit Service 7770af
// {
Packit Service 7770af
//   std::stringstream buffer;
Packit Service 7770af
//   buffer << "[";
Packit Service 7770af
Packit Service 7770af
//   if (!v.empty())
Packit Service 7770af
//   {  buffer << v[0]; }
Packit Service 7770af
//   else
Packit Service 7770af
//   { buffer << "]"; }
Packit Service 7770af
Packit Service 7770af
//   if (v.size() == 1)
Packit Service 7770af
//   { buffer << "]"; }
Packit Service 7770af
//   else
Packit Service 7770af
//   {
Packit Service 7770af
//     for (size_t i = 1, S = v.size(); i < S; ++i) buffer << ", " << v[i];
Packit Service 7770af
//     buffer << "]";
Packit Service 7770af
//   }
Packit Service 7770af
Packit Service 7770af
//   return buffer.str();
Packit Service 7770af
// }
Packit Service 7770af
Packit Service 7770af
// template<typename T>
Packit Service 7770af
// std::string set_to_string(set<T> v)
Packit Service 7770af
// {
Packit Service 7770af
//   std::stringstream buffer;
Packit Service 7770af
//   buffer << "[";
Packit Service 7770af
//   typename std::set<T>::iterator i = v.begin();
Packit Service 7770af
//   if (!v.empty())
Packit Service 7770af
//   {  buffer << *i; }
Packit Service 7770af
//   else
Packit Service 7770af
//   { buffer << "]"; }
Packit Service 7770af
Packit Service 7770af
//   if (v.size() == 1)
Packit Service 7770af
//   { buffer << "]"; }
Packit Service 7770af
//   else
Packit Service 7770af
//   {
Packit Service 7770af
//     for (++i; i != v.end(); ++i) buffer << ", " << *i;
Packit Service 7770af
//     buffer << "]";
Packit Service 7770af
//   }
Packit Service 7770af
Packit Service 7770af
//   return buffer.str();
Packit Service 7770af
// }
Packit Service 7770af
Packit Service 7770af
namespace Sass {
Packit Service 7770af
Packit Service 7770af
  class Subset_Map {
Packit Service 7770af
  private:
Packit Service 7770af
    std::vector<SubSetMapPair> values_;
Packit Service 7770af
    std::map<Simple_Selector_Obj, std::vector<std::pair<Compound_Selector_Obj, size_t> >, OrderNodes > hash_;
Packit Service 7770af
  public:
Packit Service 7770af
    void put(const Compound_Selector_Obj& sel, const SubSetMapPair& value);
Packit Service 7770af
    std::vector<SubSetMapPair> get_kv(const Compound_Selector_Obj& s);
Packit Service 7770af
    std::vector<SubSetMapPair> get_v(const Compound_Selector_Obj& s);
Packit Service 7770af
    bool empty() { return values_.empty(); }
Packit Service 7770af
    void clear() { values_.clear(); hash_.clear(); }
Packit Service 7770af
    const std::vector<SubSetMapPair> values(void) { return values_; }
Packit Service 7770af
  };
Packit Service 7770af
Packit Service 7770af
}
Packit Service 7770af
Packit Service 7770af
#endif