#ifndef LLMR_STYLE_STYLE_PARSER #define LLMR_STYLE_STYLE_PARSER #include #include namespace llmr { class StyleParser { public: using JSVal = const rapidjson::Value&; void parseBuckets(JSVal value, std::map& buckets); void parseLayers(JSVal value, std::vector& layers); void parseConstants(JSVal value); void parseClasses(JSVal value, std::map &classes, const std::map &buckets, const std::vector &layers); private: LayerDescription parseLayer(JSVal value); BucketDescription parseBucket(JSVal value); std::pair parseClassDescription(JSVal value, const std::map &buckets, const std::map &layerBuckets); void parseClass(const std::string &name, JSVal value, ClassDescription &class_desc, const std::map &buckets, const std::map &layerBuckets); void parseGenericClass(ClassProperties &klass, JSVal value); ClassProperties parseFillClass(JSVal value); ClassProperties parseLineClass(JSVal value); ClassProperties parseIconClass(JSVal value); ClassProperties parseTextClass(JSVal value); ClassProperties parseBackgroundClass(JSVal value); ClassProperties parseRasterClass(JSVal value); ClassProperties parseCompositeClass(JSVal value); PropertyFilterExpression parseFilterOrExpression(JSVal value); bool parseBoolean(JSVal value); std::string parseString(JSVal value); JSVal replaceConstant(JSVal value); std::vector parseArray(JSVal value, uint16_t expected_count); Color parseColor(JSVal value); Value parseValue(JSVal value); FunctionProperty::fn parseFunctionType(JSVal type); FunctionProperty parseFunction(JSVal value); void parseTransition(ClassProperties &klass, ClassPropertyKey key, JSVal value, std::string property_name); private: std::map constants; }; } #endif