Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Limit.h

Go to the documentation of this file.

    00001 //------------------------------------------------------------------------------
    00002 // Lamp : Open source game middleware
    00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
    00004 //
    00005 // This library is free software; you can redistribute it and/or
    00006 // modify it under the terms of the GNU Lesser General Public
    00007 // License as published by the Free Software Foundation; either
    00008 // version 2.1 of the License, or (at your option) any later version.
    00009 //
    00010 // This library is distributed in the hope that it will be useful,
    00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013 // Lesser General Public License for more details.
    00014 //
    00015 // You should have received a copy of the GNU Lesser General Public
    00016 // License along with this library; if not, write to the Free Software
    00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00018 //------------------------------------------------------------------------------
    00019
    00020 /** @file
    00021  * 限界値ヘッダ
    00022  * @author Junpee
    00023  */
    00024
    00025 #ifndef LIMIT_H_
    00026 #define LIMIT_H_
    00027
    00028 namespace Lamp{
    00029
    00030 //------------------------------------------------------------------------------
    00031 /**
    00032  * 限界値
    00033  */
    00034 class Limit{
    00035 public:
    00036     /// char最小値
    00037     static const char charMin = (-128);
    00038     /// char最大値
    00039     static const char charMax = (127);
    00040     /// u_char最小値
    00041     static const u_char uCharMin = (0);
    00042     /// u_char最大値
    00043     static const u_char uCharMax = (0xff);
    00044
    00045     /// short最小値
    00046     static const short shortMin = (-32768);
    00047     /// short最大値
    00048     static const short shortMax = (32767);
    00049     /// u_short最小値
    00050     static const u_short uShortMin = (0);
    00051     /// u_short最大値
    00052     static const u_short uShortMax = (0xffff);
    00053
    00054     /// int最小値
    00055     static const int intMin = (-2147483647 - 1);
    00056     /// int最大値
    00057     static const int intMax = (2147483647);
    00058     /// u_int最小値
    00059     static const u_int uIntMin = (0);
    00060     /// u_int最大値
    00061     static const u_int uIntMax = (0xffffffff);
    00062
    00063     /// float最小の正数
    00064     static const float floatPositiveMin;
    00065     /// float最大値
    00066     static const float floatMax;
    00067     /// float最大値平方根
    00068     static const float floatMaxSqrt;
    00069
    00070     /// double最小値
    00071     static const double doubleMin;
    00072     /// double最大値
    00073     static const double doubleMax;
    00074
    00075     //--------------------------------------------------------------------------
    00076     /**
    00077      * charの範囲内か
    00078      * @param value チェックする値
    00079      */
    00080     static bool inCharRange(int value){
    00081         return ((value >= charMin) && (value <= charMax));
    00082     }
    00083
    00084     /**
    00085      * u_charの範囲内か
    00086      * @param value チェックする値
    00087      */
    00088     static bool inUCharRange(int value){
    00089         return ((value >= uCharMin) && (value <= uCharMax));
    00090     }
    00091
    00092     //--------------------------------------------------------------------------
    00093     /**
    00094      * shortの範囲内か
    00095      * @param value チェックする値
    00096      */
    00097     static bool inShortRange(int value){
    00098         return ((value >= shortMin) && (value <= shortMax));
    00099     }
    00100
    00101     /**
    00102      * u_shortの範囲内か
    00103      * @param value チェックする値
    00104      */
    00105     static bool inUShortRange(int value){
    00106         return ((value >= uShortMin) && (value <= uShortMax));
    00107     }
    00108
    00109 private:
    00110     //--------------------------------------------------------------------------
    00111     // コンストラクタの隠蔽
    00112     Limit();
    00113
    00114 };
    00115
    00116 //------------------------------------------------------------------------------
    00117 } // End of namespace Lamp
    00118 #endif // End of _H_
    00119 //------------------------------------------------------------------------------