valuelist.h

来自「表达式计算expression evaluate expression eval」· C头文件 代码 · 共 69 行

H
69
字号
/******************************************************************************
文件名          :ValueList.h
版本号          : 1.0
作者            : Amos Peng
生成日期        :2008-07-08
最近修改        :
功能描述        :
函数列表        :

*******************************************************************************/
#ifndef _VALUELIST_H_
#define _VALUELIST_H_
// Includes
#include <string>
#include <vector>

#include <new>
#include <memory>

#include "Defines.h"
#include "ValueListItem.h"
#include "Except.h"

// Part of expreval namespace
namespace ExprEval
{    
    // Value list
    //--------------------------------------------------------------------------
    class CValueList
    {
        public:
            typedef ::std::vector<CValueListItem*>::size_type size_type;
                
            CValueList();
            ~CValueList();
        
            // Add variable or constant to the list
            void Add(const ::std::string &name, double def = 0.0, bool constant = false);
        
            // Add an external variable or constant to the list
            void AddAddress(const ::std::string &name, double *ptr, double def = 0.0, bool constant = false);
        
            // Get the address of a variable or constant, internal or external
            double *GetAddress(const ::std::string &name) const;
        
            // Is the value constant
            bool IsConstant(const ::std::string &name) const;
        
            // Enumerate values
            size_type Count() const;
            void Item(size_type pos, ::std::string *name = 0, double *value = 0) const;
        
            // Initialize some default values (math constants)
            void AddDefaultValues();
        
            // Reset items to default values (constants are not changed)
            void Reset();
        
            // Free items and clear memory
            void Clear();
    
        private:
            ::std::vector<CValueListItem*> m_values;
    };
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?