[gqq] Re: 再次切换回gtkmm2.4

  • From: 纵横天下 <zhtx10@xxxxxxxxx>
  • To: gqq@xxxxxxxxxxxxx
  • Date: Tue, 04 Jan 2011 13:17:57 +0800

感觉没啥用处,光增加了输入的麻烦,对于命名空间,会降低编译速度,启动速度
以及main函数管理的速度,输入也麻烦,对于代码还是简单为好,编 写和维护都
容易,最好还是平行,不要弄太多层次。

于 2011年01月04日 11:30, Eros 写道:
> 还是我的废话一大堆~~~ 见谅 ^_^
>
> 不如整体包含在一个命名空间里面吧 GNOME_QQ?
>
> 文件加上前缀 gqq_ 类加上前缀GQQ_ 全局变量也加上前缀 gqq_
>
> 还有 把debug 宏和函数 独立出来吧~~ 这样debug的功能更加独立一点
>
> 同时 global 里面是全局变量定义
>
> 类型定义的话 这个我有一个疑问 gtkmm的变量类型不是与 gtk一样的么?
>
> 如果重新定义的话 还是要加上前缀 和 放在命名空间里面比较好吧
>
> #ifndef _OL_DEBUG_H_
> #define _OL_DEBUG_H_
>
> #include <stdio.h>
>
> enum OlDebugLevel {
> OL_LOG_NONE = -1,
> OL_ERROR = 0,
> OL_DEBUG = 1,
> OL_INFO = 2,
> OL_N_LEVELS,
> };
>
> #define ol_logf(level, ...) do {ol_log_printf (level, \
> __FILE__, \
> __LINE__, \
> __FUNCTION__, \
> __VA_ARGS__); } while (0)
> #define ol_log_func() do {ol_logf (OL_INFO, "%s\n", __FUNCTION__); }
> while (0)
> #define ol_debugf(...) do {ol_logf (OL_DEBUG, __VA_ARGS__); } while (0)
> #define ol_debug(...) do {ol_logf (OL_DEBUG, "%s\n", __VA_ARGS__); }
> while (0)
> #define ol_errorf(...) do {ol_logf (OL_ERROR, __VA_ARGS__); } while (0)
> #define ol_error(...) do {ol_logf (OL_ERROR, "%s\n", __VA_ARGS__); }
> while (0)
> #define ol_infof(...) do {ol_logf (OL_INFO, __VA_ARGS__); } while (0)
> #define ol_info(...) do {ol_logf (OL_INFO, "%s\n", __VA_ARGS__); }
> while (0)
> #define ol_assert(assertion) do {if (!(assertion)) { \
> ol_logf (OL_ERROR, "assert %s failed\n", #assertion); \
> return; \
> }} while (0)
> #define ol_assert_ret(assertion, ret) do {if (!(assertion)) { \
> ol_logf (OL_ERROR, "assert %s failed\n", #assertion); \
> return (ret); \
> }} while (0)
>
> void ol_log_printf (int level, const char *file, int line, const char
> *funcname,
> const char *fmt, ...);
>
> /**
> * @brief Sets the message level to be logged
> *
> * @param level The level of message to be logged. There are 4
> levels:<br />
> * OL_LOG_NONE: Log nothing
> * OL_ERROR: Log only messages with OL_ERROR
> * OL_DEBUG: Log messages with OL_ERROR and OL_DEBUG
> * OL_INFO: Log all messages
> */
> void ol_log_set_level (enum OlDebugLevel level);
>
> /**
> * @brief Sets the file to store log messages.
> *
> * @param logfile The filename of the log file. if logfile is "-", it
> represents
> * standard output
> * @return Return 1 if succeeded, or 0 if failed.
> */
> int ol_log_set_file (const char *logfile);
>
> #endif /* _OL_DEBUG_H_ */
>
> 这个是 OSD Lyrics 的 debug 头文件 觉得很有参考价值
>


Other related posts: