Subversion Repositories tpanel

Rev

Rev 3 | Blame | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */
#ifndef __TPAGELIST_H__
#define __TPAGELIST_H__

#include <string>
#include <vector>
#include "tvalidatefile.h"

typedef struct PAGELIST_T
{
    std::string name;
    int pageID{0};
    std::string file;
    int isValid{-1};

    void clear()
    {
        name.clear();
        pageID = 0;
        file.clear();
        isValid = -1;
    }
}PAGELIST_T;

typedef struct SUBPAGELIST_T
{
    std::string name;
    int pageID{0};
    std::string file;
    std::string group;
    int isValid{-1};
    int popupType{0};

    void clear()
    {
        name.clear();
        pageID = 0;
        file.clear();
        group.clear();
        isValid = -1;
        popupType = 0;
    }
}SUBPAGELIST_T;

class TPageList : public TValidateFile
{
    public:
        TPageList();
        ~TPageList();

        void initialize();

        PAGELIST_T findPage(const std::string& name);
        PAGELIST_T findPage(int pageID);
        SUBPAGELIST_T findSubPage(const std::string& name);
        SUBPAGELIST_T findSubPage(int pageID);

        std::vector<PAGELIST_T>& getPagelist() { return mPageList; }
        std::vector<SUBPAGELIST_T>& getSupPageList() { return mSubPageList; }

    private:
        std::string mProject;
        std::vector<PAGELIST_T> mPageList;
        std::vector<SUBPAGELIST_T> mSubPageList;
};

#endif