⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgccommand.h

📁 《3D游戏引擎设计》的源码
💻 H
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// FREE SOURCE CODE
// http://www.magic-software.com/License/free.pdf

#ifndef MGCCOMMAND_H
#define MGCCOMMAND_H

class MgcCommand
{
public:
    MgcCommand (int iArgc, char** ppArgv);
    MgcCommand (char* pCmdline);
    ~MgcCommand ();
    int ExcessArguments ();  // return values is index of first excess argument

    // set bounds for numerical arguments
    // if bounds required, they must be set for each argument
    MgcCommand& Min (double dValue);
    MgcCommand& Max (double dValue);
    MgcCommand& Inf (double dValue);
    MgcCommand& Sup (double dValue);

    // return value of the following methods is the option index within the
    // argument array

    // Use the boolean methods for options which take no argument, for
    // example in
    //           myprogram -debug -x 10 -y 20 filename
    // the option -debug has no argument.

    int Boolean (char* pName);  // returns existence of option
    int Boolean (char* pName, bool& bValue);
    int Integer (char* pName, int& iValue);
    int Float (char* pName, float& fValue);
    int Double (char* pName, double& dValue);
    int String (char* pName, char* pValue);
    int Filename (char* pName);

    // last error reporting
    const char* GetLastError () { return m_pLastError; }

protected:
    // constructor support
    void Initialize ();

    // command line information
    int m_iArgc;       // number of arguments
    char** m_ppArgv;    // argument list (array of strings)
    char* m_pCmdline;  // argument list (single string)
    bool* m_pUsed;  // keeps track of arguments already processed

    // parameters for bounds checking
    double m_dSmall;   // lower bound for numerical argument (min or inf)
    double m_dLarge;   // upper bound for numerical argument (max or sup)
    bool m_bMinSet;    // if true, compare:  small <= arg
    bool m_bMaxSet;    // if true, compare:  arg <= large
    bool m_bInfSet;    // if true, compare:  small < arg
    bool m_bSupSet;    // if true, compare:  arg < large

    // last error strings
    char* m_pLastError;
    static char ms_pOptionNotFound[];
    static char ms_pArgumentRequired[];
    static char ms_pArgumentOutOfRange[];
    static char ms_pFilenameNotFound[];
};

#endif

⌨️ 快捷键说明

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