汎用ヘッダファイルの作成

頻繁に使用するものをまとめてヘッダファイルを定義しておくと便利です。
このWEBサイトにある一部のソースは、このtypes.hとchlibs.hを使用しています。

types.hの作成

Classes/chlibs/types.h
#ifndef _CHIME_TYPES_
#define _CHIME_TYPES_
 
#ifndef lengthof
    #define lengthof(a) (sizeof(a) / sizeof((a)[0]))
#endif
 
#ifdef __i386__
    #define SIMULATOR
#else
    #define DEVICE
#endif
 
#ifndef s08
    typedef char            s08 ;
#endif
#ifndef u08
    typedef unsigned char   u08 ;
#endif
#ifndef s16
    typedef short           s16 ;
#endif
#ifndef u16
    typedef unsigned short  u16 ;
#endif
#ifndef s32
    typedef int             s32 ;
#endif
#ifndef u32
    typedef unsigned int    u32 ;
#endif
 
#endif // _CHIME_TYPES_

chlibs.hの作成

Classes/chlibs/chlibs.h
//*****************************************************************************
//!     ChLibs
/*!
//      @file
*/
//*****************************************************************************
// iPhone SDK
#import <UIKit/UIKit.h>
// 型宣言
#import "types.h"
// stl
#import <deque>
#import <list>
#import <map>
#import <string>
#import <vector>
#import <fstream>
using namespace std ;