瀏覽代碼

[add] Color mode (Fix #4)
[refactor] moved indentLevel to compile-time constant
[refactor] changed selected to OutputFlag
[add] references to Params in StreamConsumer and in CurseOutput

isundil 9 年之前
父節點
當前提交
7c43d767f0

+ 2 - 2
CMakeLists.txt

@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 2.8)
 
-add_executable(jsonstroll src/main.cpp src/jsonContainer.cpp src/params.cpp src/curseOutput.cpp src/streamConsumer.cpp src/jsonArray.cpp src/jsonObjectEntry.cpp src/jsonObject.cpp src/jsonElement.cpp src/jsonPrimitive.cpp src/jsonException.cpp)
-add_executable(json_test test/src/main.cpp src/jsonContainer.cpp src/params.cpp src/streamConsumer.cpp src/jsonArray.cpp src/jsonObjectEntry.cpp src/jsonObject.cpp src/jsonElement.cpp src/jsonPrimitive.cpp src/jsonException.cpp)
+add_executable(jsonstroll src/main.cpp src/jsonContainer.cpp src/params.cpp src/curseOutput.cpp src/outputFlag.cpp src/streamConsumer.cpp src/jsonArray.cpp src/jsonObjectEntry.cpp src/jsonObject.cpp src/jsonElement.cpp src/jsonPrimitive.cpp src/jsonException.cpp)
+add_executable(json_test test/src/main.cpp src/jsonContainer.cpp src/streamConsumer.cpp src/jsonArray.cpp src/jsonObjectEntry.cpp src/jsonObject.cpp src/jsonElement.cpp src/jsonPrimitive.cpp src/jsonException.cpp)
 add_executable(wrapped_test test/src/wrapped.cpp)
 
 set_property(TARGET jsonstroll PROPERTY RUNTIME_OUTPUT_DIRECTORY bin)

+ 3 - 0
include/config.h

@@ -3,3 +3,6 @@
 # define ERROR_HISTORY_LEN 45
 #endif //ERROR_HISTORY_LEN
 
+#ifndef  INDENT_LEVEL
+# define INDENT_LEVEL 4
+#endif //INDENT_LEVEL

+ 15 - 8
include/curseOutput.hh

@@ -2,8 +2,11 @@
 
 #include <ncurses.h>
 #include <fstream>
-#include <set>
 #include <list>
+#include <set>
+#include <map>
+#include "outputFlag.hh"
+#include "params.hh"
 
 class JSonElement;
 class JSonContainer;
@@ -14,7 +17,7 @@ template<class T> class Optional;
 class CurseOutput
 {
     public:
-        CurseOutput(JSonElement *rootData);
+        CurseOutput(JSonElement *rootData, const Params &);
         virtual ~CurseOutput();
 
         void run();
@@ -35,22 +38,26 @@ class CurseOutput
         void getScreenSize(std::pair<unsigned int, unsigned int> &, std::pair<int, int> &) const;
         void checkSelection(const JSonElement *item, const JSonElement *parent, const std::pair<int, int>&);
         static unsigned int getNbLines(float nbChar, unsigned int maxWidth);
-        unsigned int write(const int &x, const int &y, const JSonElement *item, unsigned int maxWidth, bool selected =false);
-        unsigned int write(const int &x, const int &y, const std::string &item, unsigned int maxWidth, bool selected =false);
-        unsigned int write(const int &x, const int &y, const char item, unsigned int maxWidth, bool selected =false);
-        unsigned int write(const int &x, const int &y, const char *item, unsigned int maxWidth, bool selected =false);
-        bool writeKey(const std::string &key, std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxWidth, bool selected);
+        const OutputFlag getFlag(const JSonElement *item) const;
+        void write(const char *str, unsigned int maxWidth, const OutputFlag flags) const;
+        unsigned int write(const int &x, const int &y, const JSonElement *item, unsigned int maxWidth, const OutputFlag);
+        unsigned int write(const int &x, const int &y, const std::string &item, unsigned int maxWidth, const OutputFlag);
+        unsigned int write(const int &x, const int &y, const char item, unsigned int maxWidth, const OutputFlag);
+        unsigned int write(const int &x, const int &y, const char *item, unsigned int maxWidth, const OutputFlag);
+        bool writeKey(const std::string &key, std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxWidth, OutputFlag, unsigned int extraLen =0);
+        bool writeKey(const std::string &key, const std::string &after, std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxWidth, OutputFlag);
         bool writeContainer(std::pair<int, int> &, const std::pair<unsigned int, unsigned int> &maxSize, const JSonContainer *);
         bool writeContent(std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxSize, const std::list<JSonElement *> * obj);
 
         std::set<const JSonContainer *> collapsed;
 
         const JSonElement *data, *selection;
+        const Params &params;
         SCREEN *screen;
         FILE *screen_fd;
         bool breakLoop;
         int topleft;
-        const unsigned int indentLevel;
+        std::set<char> colors;
 
         const JSonElement *select_up, *select_down;
         bool selectFound, selectIsLast, selectIsFirst;

+ 7 - 1
include/jsonPrimitive.hh

@@ -2,8 +2,14 @@
 
 #include "jsonElement.hh"
 
+class AJsonPrimitive
+{
+    public:
+        virtual ~AJsonPrimitive();
+};
+
 template <typename T>
-class JSonPrimitive: public JSonElement
+class JSonPrimitive: public JSonElement, public AJsonPrimitive
 {
     public:
         JSonPrimitive(JSonContainer *parent, T const &v);

+ 30 - 0
include/outputFlag.hh

@@ -0,0 +1,30 @@
+#pragma once
+
+class OutputFlag
+{
+    public:
+        OutputFlag(short mode =0);
+        virtual ~OutputFlag();
+
+        bool selected() const;
+        bool selected(bool v);
+
+        char type() const;
+        char type(char t);
+
+    protected:
+        short mode;
+        char _type;
+
+    public:
+        static const short MODE_SELECTED = 1;
+
+        static const char TYPE_UNKNOWN;
+        static const char TYPE_STRING;
+        static const char TYPE_NUMBER;
+        static const char TYPE_BOOL;
+        static const char TYPE_OBJ;
+        static const char TYPE_OBJKEY;
+        static const char TYPE_ARR;
+};
+

+ 9 - 1
include/params.hh

@@ -5,7 +5,13 @@
 #include <string>
 #include <istream>
 
-class Params
+class AParams
+{
+    public:
+        virtual bool isIgnoringUnicode() const =0;
+};
+
+class Params: public AParams
 {
     public:
         Params(int ac, char **av);
@@ -13,6 +19,7 @@ class Params
 
         std::basic_istream<char> &getInput() const;
         bool isValid() const;
+        bool colorEnabled() const;
 
         static void usage(const std::string &) noexcept;
 
@@ -24,5 +31,6 @@ class Params
         const std::string progName;
         std::list<std::string> params;
         bool ignoreUnicode;
+        bool colorMode;
 };
 

+ 3 - 3
include/streamConsumer.hh

@@ -13,10 +13,10 @@ class StreamConsumer
     public:
         virtual ~StreamConsumer();
 
-        static StreamConsumer *read(std::istream &stream, const Params *params=nullptr);
+        static StreamConsumer *read(std::istream &stream, const AParams *params=nullptr);
         JSonElement * const getRoot() const;
 
-        StreamConsumer *withConfig(const Params *);
+        StreamConsumer *withConfig(const AParams *);
 
     private:
         StreamConsumer(std::istream &stream);
@@ -33,7 +33,7 @@ class StreamConsumer
 
         std::istream &stream;
         JSonElement *root;
-        const Params *params;
+        const AParams *params;
 
         WrappedBuffer<char, ERROR_HISTORY_LEN> history;
 

+ 103 - 41
src/curseOutput.cpp

@@ -7,10 +7,12 @@
 
 #include "curseOutput.hh"
 #include "jsonObject.hh"
+#include "jsonArray.hh"
+#include "jsonPrimitive.hh"
 
 static CurseOutput *runningInst = nullptr;
 
-CurseOutput::CurseOutput(JSonElement *root): data(root), selection(root), indentLevel(4)
+CurseOutput::CurseOutput(JSonElement *root, const Params &p): data(root), selection(root), params(p)
 { }
 
 CurseOutput::~CurseOutput()
@@ -107,7 +109,7 @@ bool CurseOutput::redraw(std::pair<int, int> &cursor, const std::pair<unsigned i
     }
     else
     {
-        cursor.second += write(cursor.first, cursor.second, item, maxSize.first, selection == item);
+        cursor.second += write(cursor.first, cursor.second, item, maxSize.first, getFlag(item));
         if (cursor.second - topleft > 0 && (unsigned)(cursor.second - topleft) > maxSize.second -1)
             return false;
     }
@@ -123,7 +125,7 @@ bool CurseOutput::writeContainer(std::pair<int, int> &cursor, const std::pair<un
     else
         memcpy(childDelimiter, "[]", sizeof(*childDelimiter) * 2);
 
-    cursor.first += indentLevel /2;
+    cursor.first += INDENT_LEVEL /2;
     if (collapsed.find((const JSonContainer *)item) != collapsed.end())
     {
         std::string ss;
@@ -139,7 +141,7 @@ bool CurseOutput::writeContainer(std::pair<int, int> &cursor, const std::pair<un
             return false;
         cursor.second += write(cursor.first, cursor.second, childDelimiter[1], maxSize.first, selection == item);
     }
-    cursor.first -= indentLevel /2;
+    cursor.first -= INDENT_LEVEL /2;
     return (cursor.second - topleft < 0 || (unsigned)(cursor.second - topleft) <= maxSize.second -1);
 }
 
@@ -147,7 +149,7 @@ bool CurseOutput::writeContent(std::pair<int, int> &cursor, const std::pair<unsi
 {
     const JSonContainer *item = (const JSonContainer *)_item;
     bool containerIsObject = (dynamic_cast<const JSonObject *>(item) != nullptr);
-    cursor.first += indentLevel /2;
+    cursor.first += INDENT_LEVEL /2;
     for (std::list<JSonElement *>::const_iterator i = item->cbegin(); i != item->cend(); ++i)
     {
         if (containerIsObject)
@@ -159,24 +161,24 @@ bool CurseOutput::writeContent(std::pair<int, int> &cursor, const std::pair<unsi
             if (isContainer && collapsed.find((const JSonContainer*)(**ent)) != collapsed.cend())
             {
                 if (dynamic_cast<const JSonObject *>(**ent))
-                    cursor.second += write(cursor.first, cursor.second, key + ": { ... }", maxSize.first, selection == ent);
+                    writeKey(key, "{ ... }", cursor, maxSize, getFlag(ent));
                 else
-                    cursor.second += write(cursor.first, cursor.second, key + ": [ ... ]", maxSize.first, selection == ent);
+                    writeKey(key, "[ ... ]", cursor, maxSize, getFlag(ent));
                 if (cursor.second - topleft > 0 && (unsigned)(cursor.second - topleft) > maxSize.second -1)
                         return false;
             }
             else if (!isContainer)
             {
-                cursor.second += write(cursor.first, cursor.second, key + ": " +((**ent)->stringify()), maxSize.first, selection == ent);
+                writeKey(key, ((**ent)->stringify()), cursor, maxSize, getFlag(ent));
                 if (cursor.second - topleft > 0 && (unsigned)(cursor.second - topleft) > maxSize.second -1)
                         return false;
             }
             else if (((JSonContainer*)(**ent))->size() == 0)
             {
                 if (dynamic_cast<const JSonObject *>(**ent) )
-                    cursor.second += write(cursor.first, cursor.second, key + ": { }", maxSize.first, selection == ent);
+                    writeKey(key, "{ }", cursor, maxSize, getFlag(ent));
                 else
-                    cursor.second += write(cursor.first, cursor.second, key + ": [ ]", maxSize.first, selection == ent);
+                    writeKey(key, "[ ]", cursor, maxSize, getFlag(ent));
                 if (cursor.second - topleft > 0 && (unsigned)(cursor.second - topleft) > maxSize.second -1)
                         return false;
             }
@@ -184,7 +186,7 @@ bool CurseOutput::writeContent(std::pair<int, int> &cursor, const std::pair<unsi
             {
                 if (!writeKey(key, cursor, maxSize, selection == ent))
                     return false;
-                cursor.first -= indentLevel /2;
+                cursor.first -= INDENT_LEVEL /2;
                 const JSonElement *saveSelection = selection;
                 if (selection == ent)
                     selection = **ent;
@@ -194,7 +196,7 @@ bool CurseOutput::writeContent(std::pair<int, int> &cursor, const std::pair<unsi
                     return false;
                 }
                 selection = saveSelection;
-                cursor.first -= indentLevel /2;
+                cursor.first -= INDENT_LEVEL /2;
             }
         }
         else
@@ -203,65 +205,93 @@ bool CurseOutput::writeContent(std::pair<int, int> &cursor, const std::pair<unsi
                 return false;
         }
     }
-    cursor.first -= indentLevel /2;
+    cursor.first -= INDENT_LEVEL /2;
     return true;
 }
 
-bool CurseOutput::writeKey(const std::string &key, std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxSize, bool selected)
+bool CurseOutput::writeKey(const std::string &key, const std::string &after, std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxSize, OutputFlag flags)
 {
-    cursor.second += write(cursor.first, cursor.second, key +": ", maxSize.first, selected);
-    cursor.first += indentLevel;
+    writeKey(key, cursor, maxSize, flags, after.size());
+    write(after.c_str(), maxSize.first, flags);
+    cursor.first -= INDENT_LEVEL;
     return (cursor.second - topleft < 0 || (unsigned)(cursor.second - topleft) <= maxSize.second -1);
 }
 
-unsigned int CurseOutput::write(const int &x, const int &y, const JSonElement *item, unsigned int maxWidth, bool selected)
+bool CurseOutput::writeKey(const std::string &key, std::pair<int, int> &cursor, const std::pair<unsigned int, unsigned int> &maxSize, OutputFlag flags, unsigned int extraLen)
 {
-    return write(x, y, item->stringify(), maxWidth, selected);
+    char oldType = flags.type();
+    flags.type(OutputFlag::TYPE_OBJKEY);
+    cursor.second += write(cursor.first, cursor.second, key, maxSize.first -extraLen -2, flags);
+    flags.type(OutputFlag::TYPE_OBJ);
+    write(": ", maxSize.first, flags);
+    flags.type(oldType);
+    cursor.first += INDENT_LEVEL;
+    return (cursor.second - topleft < 0 || (unsigned)(cursor.second - topleft) <= maxSize.second -1);
+}
+
+unsigned int CurseOutput::write(const int &x, const int &y, const JSonElement *item, unsigned int maxWidth, OutputFlag flags)
+{
+    return write(x, y, item->stringify(), maxWidth, flags);
 }
 
-unsigned int CurseOutput::write(const int &x, const int &y, const char item, unsigned int maxWidth, bool selected)
+unsigned int CurseOutput::write(const int &x, const int &y, const char item, unsigned int maxWidth, OutputFlag flags)
 {
     int offsetY = y - topleft;
     if (offsetY < 0)
         return 1;
-    if (selected)
-    {
+    if (flags.selected())
         attron(A_REVERSE | A_BOLD);
-        mvprintw(offsetY, x, "%c", item);
-        attroff(A_REVERSE | A_BOLD);
-    }
-    else
-        mvprintw(offsetY, x, "%c", item);
+    bool color = (colors.find(flags.type()) != colors.end());
+    if (color)
+        attron(COLOR_PAIR(flags.type()));
+    mvprintw(offsetY, x, "%c", item);
+    attroff(A_REVERSE | A_BOLD);
+    if (color)
+        attroff(COLOR_PAIR(flags.type()));
     return getNbLines(x +1, maxWidth);
 }
 
-unsigned int CurseOutput::getNbLines(float nbChar, unsigned int maxWidth)
+void CurseOutput::write(const char *str, unsigned int maxWidth, const OutputFlag flags) const
 {
-    float nLine = nbChar / maxWidth;
-    if (nLine == (unsigned int) nLine)
-        return nLine;
-    return nLine +1;
+    if (flags.selected())
+        attron(A_REVERSE | A_BOLD);
+    bool color = (colors.find(flags.type()) != colors.end());
+    if (color)
+        attron(COLOR_PAIR(flags.type()));
+    printw("%s", str);
+    attroff(A_REVERSE | A_BOLD);
+    if (color)
+        attroff(COLOR_PAIR(flags.type()));
 }
 
-unsigned int CurseOutput::write(const int &x, const int &y, const char *str, unsigned int maxWidth, bool selected)
+unsigned int CurseOutput::write(const int &x, const int &y, const char *str, unsigned int maxWidth, const OutputFlag flags)
 {
     int offsetY = y - topleft;
     if (offsetY < 0)
         return 1;
-    if (selected)
-    {
+    if (flags.selected())
         attron(A_REVERSE | A_BOLD);
-        mvprintw(offsetY, x, "%s", str);
-        attroff(A_REVERSE | A_BOLD);
-    }
-    else
-        mvprintw(offsetY, x, "%s", str);
+    bool color = (colors.find(flags.type()) != colors.end());
+    if (color)
+        attron(COLOR_PAIR(flags.type()));
+    mvprintw(offsetY, x, "%s", str);
+    attroff(A_REVERSE | A_BOLD);
+    if (color)
+        attroff(COLOR_PAIR(flags.type()));
     return getNbLines(strlen(str) +x, maxWidth);
 }
 
-unsigned int CurseOutput::write(const int &x, const int &y, const std::string &str, unsigned int maxWidth, bool selected)
+unsigned int CurseOutput::write(const int &x, const int &y, const std::string &str, unsigned int maxWidth, const OutputFlag flags)
 {
-    return write(x, y, str.c_str(), maxWidth, selected);
+    return write(x, y, str.c_str(), maxWidth, flags);
+}
+
+unsigned int CurseOutput::getNbLines(float nbChar, unsigned int maxWidth)
+{
+    float nLine = nbChar / maxWidth;
+    if (nLine == (unsigned int) nLine)
+        return nLine;
+    return nLine +1;
 }
 
 void CurseOutput::getScreenSize(std::pair<unsigned int, unsigned int> &screenSize, std::pair<int, int> &bs) const
@@ -270,6 +300,25 @@ void CurseOutput::getScreenSize(std::pair<unsigned int, unsigned int> &screenSiz
     getbegyx(stdscr, bs.second, bs.first);
 }
 
+const OutputFlag CurseOutput::getFlag(const JSonElement *item) const
+{
+    OutputFlag res;
+    const JSonElement *i = dynamic_cast<const JSonObjectEntry*>(item) ? **((const JSonObjectEntry*)item) : item;
+
+    res.selected(item == selection);
+    if (dynamic_cast<const JSonPrimitive<std::string> *>(i))
+        res.type(OutputFlag::TYPE_STRING);
+    else if (dynamic_cast<const JSonPrimitive<bool> *>(i))
+        res.type(OutputFlag::TYPE_BOOL);
+    else if (dynamic_cast<const AJsonPrimitive *>(i))
+        res.type(OutputFlag::TYPE_NUMBER);
+    else if (dynamic_cast<const JSonObject*>(i))
+        res.type(OutputFlag::TYPE_OBJ);
+    else if (dynamic_cast<const JSonArray*>(i))
+        res.type(OutputFlag::TYPE_ARR);
+    return res;
+}
+
 void CurseOutput::checkSelection(const JSonElement *item, const JSonElement *parent, const std::pair<int, int> &cursor)
 {
     if (!selectFound)
@@ -430,6 +479,19 @@ void CurseOutput::init()
     curs_set(false);
     keypad(stdscr, true);
 
+    if (params.colorEnabled())
+    {
+        start_color();
+        init_pair(OutputFlag::TYPE_NUMBER, COLOR_GREEN, COLOR_BLACK);
+        init_pair(OutputFlag::TYPE_BOOL, COLOR_RED, COLOR_BLACK);
+        init_pair(OutputFlag::TYPE_STRING, COLOR_CYAN, COLOR_BLACK);
+        init_pair(OutputFlag::TYPE_OBJKEY, COLOR_CYAN, COLOR_BLACK);
+        colors.insert(OutputFlag::TYPE_NUMBER);
+        colors.insert(OutputFlag::TYPE_BOOL);
+        colors.insert(OutputFlag::TYPE_STRING);
+        colors.insert(OutputFlag::TYPE_OBJKEY);
+    }
+
     signal(SIGWINCH, _resizeFnc);
     signal(SIGINT, _resizeFnc);
     signal(SIGTERM, _resizeFnc);

+ 3 - 0
src/jsonPrimitive.cpp

@@ -1,5 +1,8 @@
 #include "jsonPrimitive.hh"
 
+AJsonPrimitive::~AJsonPrimitive()
+{}
+
 template<> JSonPrimitive<double>::~JSonPrimitive() {}
 template<> JSonPrimitive<bool>::~JSonPrimitive() {}
 template<> JSonPrimitive<int>::~JSonPrimitive() {}

+ 1 - 1
src/main.cpp

@@ -30,7 +30,7 @@ void run(Params *params)
         std::cerr << buffer << std::endl << std::string(buffer.size() -1, '~') << '^' << std::endl;
         return;
     }
-    out = new CurseOutput(root);
+    out = new CurseOutput(root, *params);
     out->run();
     delete out;
     delete stream;

+ 34 - 0
src/outputFlag.cpp

@@ -0,0 +1,34 @@
+#include "outputFlag.hh"
+
+const char OutputFlag::TYPE_UNKNOWN =0;
+const char OutputFlag::TYPE_STRING  =1;
+const char OutputFlag::TYPE_NUMBER  =2;
+const char OutputFlag::TYPE_BOOL    =3;
+const char OutputFlag::TYPE_OBJ     =4;
+const char OutputFlag::TYPE_OBJKEY  =5;
+const char OutputFlag::TYPE_ARR     =6;
+
+OutputFlag::OutputFlag(short m): mode(m)
+{ }
+
+OutputFlag::~OutputFlag()
+{ }
+
+bool OutputFlag::selected() const
+{ return mode & OutputFlag::MODE_SELECTED; }
+
+bool OutputFlag::selected(bool v)
+{
+    if (v)
+        mode |= OutputFlag::MODE_SELECTED;
+    else
+        mode &= ~OutputFlag::MODE_SELECTED;
+    return v;
+}
+
+char OutputFlag::type() const
+{ return _type; }
+
+char OutputFlag::type(char t)
+{ return _type = t; }
+

+ 21 - 0
src/params.cpp

@@ -1,6 +1,8 @@
 #include <fstream>
 #include <iostream>
 #include <sstream>
+#include <curses.h>
+#include <unistd.h>
 #include "params.hh"
 
 Params::Params(int ac, char **av) :progName(*av), params(std::list<std::string>(ac -1))
@@ -8,6 +10,7 @@ Params::Params(int ac, char **av) :progName(*av), params(std::list<std::string>(
     bool written = false;
     std::stringstream *input = nullptr;
     ignoreUnicode = false;
+    colorMode = isatty(1);
 
     while (*(++av))
     {
@@ -33,6 +36,20 @@ Params::Params(int ac, char **av) :progName(*av), params(std::list<std::string>(
             }
             else if (tmp == "--ascii")
                 ignoreUnicode = true;
+            else if (tmp == "--color")
+                colorMode = true;
+            else if (tmp.find("--color=") == 0)
+            {
+                std::string mode = (*av) + 8;
+                if (mode == "always")
+                    colorMode = true;
+                else if (mode == "never")
+                    colorMode = false;
+                else if (mode == "auto")
+                    colorMode = isatty(1);
+                else
+                    throw std::runtime_error("Invalid option for --color: " +mode);
+            }
             else
                 throw std::runtime_error("Invalid argument: " +tmp);
         }
@@ -67,11 +84,15 @@ void Params::usage(const std::string &progName) noexcept
     std::cout << "Usage: " << progName << " [OPTIONS] [--] INPUT" << std::endl;
     std::cout << "\t\t-f filename\tread input from (filename) instead of stdin" << std::endl;
     std::cout << "\t\t--ascii\tignore unicode values" << std::endl;
+    std::cout << "\t\t--color[=MODE]\tColorize output, MODE can be always (default when ommited), never or auto (default if --color is ommited)" << std::endl;
 }
 
 bool Params::isValid() const
 { return true; }
 
+bool Params::colorEnabled() const
+{ return colorMode; }
+
 bool Params::isIgnoringUnicode() const
 { return ignoreUnicode; }
 

+ 2 - 2
src/streamConsumer.cpp

@@ -13,13 +13,13 @@ StreamConsumer::~StreamConsumer()
         delete root;
 }
 
-StreamConsumer *StreamConsumer::withConfig(const Params *p)
+StreamConsumer *StreamConsumer::withConfig(const AParams *p)
 {
     params = p;
     return this;
 }
 
-StreamConsumer *StreamConsumer::read(std::istream &stream, const Params *config)
+StreamConsumer *StreamConsumer::read(std::istream &stream, const AParams *config)
 {
     StreamConsumer *inst = (new StreamConsumer(stream))->withConfig(config);
     inst->root = inst->readNext(nullptr);