profile.h

来自「联通接收发送新程序」· C头文件 代码 · 共 62 行

H
62
字号
/* Copyright(C) 1999, 2000 by JiangSu Bell Software CO.,LTD. */
/*
  Name: profile.h                      Version: 1.0.0
  Created by HanBing                   Date: 2000-08-22
  Comment: Our group defining all base-class sets
  Modified:
1)  2000-08-22	HanBing	-	Create;
*/

#ifndef __PROFILE__
#define __PROFILE__

extern "C"
{
  bool GetProfileStr( const char* File, const char* Section, const char* Entry, char* Result );
  bool WriteProfileStr( const char* File, const char* Section, const char* Entry, char* Result );
}

extern char AppName[100];
extern char LogName[100];
extern char ConfName[100];

class LOG
{
  public:
    static void DBG( const long x, const char* file = NULL, const int line = 0 );
    static void DBG( const double x, const char* file = NULL, const int line = 0 );
    static void DBG( const char* x, const char* file = NULL, const int line = 0 );
    static inline bool GetConfStr( const char* Entry, char* Result )
    {
      return GetProfileStr( ConfName, AppName, Entry, Result );
    }
    static inline bool WriteConfStr( const char* Entry, char* Result )
    {
      return WriteProfileStr( ConfName, AppName, Entry, Result );
    }
};

inline void SetAppName( const char* App )
{
  strcpy( AppName, App );
  strcpy( LogName, App );
  strcat( LogName, ".log" );
}

inline bool GetConfigStr( const char* Entry, char* Result )
{
  return LOG :: GetConfStr( Entry, Result );
}

inline bool WriteConfigStr( const char* Entry, char* Result )
{
  return LOG :: WriteConfStr( Entry, Result );
}

extern "C" bool DoDebug( short lvl = 0 );

#define Debug( l, x ) { if ( DoDebug( l ) ) LOG::DBG( x, __FILE__, __LINE__ ); }
#define Log( x ) { if ( DoDebug() ) LOG::DBG( x ); }

#endif //__PROFILE__

⌨️ 快捷键说明

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