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

📄 tracetool.h.svn-base

📁 股票软件源码
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
   
   //-------------------------------------------------------------------------
   
   /// front : code + int
   void AddFront(const int msg, const int intValue)
   {
      char message[20];
      #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
      sprintf_s(message, 20, "%5d%11d", msg, intValue);         // 5 + 11 + 1
      #else
      sprintf(message, "%5d%11d", msg, intValue);         // 5 + 11 + 1
      #endif
      push_front (message) ;
   }
   //-------------------------------------------------------------------------
   
   /// back : code + int + string
   void Add(const int msg, const int intValue, const char * StrValue)
   {
      char * message ;

      if (StrValue == NULL)
      {
         message = (char*)malloc(17) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf_s(message,17, "%5d%11d", msg, intValue);
         #else
         sprintf(message, "%5d%11d", msg, intValue);
         #endif
      } else {
         int messLen = 17+strlen(StrValue) ;
         message = (char*)malloc(messLen) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf_s(message,messLen, "%5d%11d%s", msg, intValue, StrValue);  // 5 + 11 + xxx + 1
         #else
         sprintf(message, "%5d%11d%s", msg, intValue, StrValue);  // 5 + 11 + xxx + 1
         #endif
      }

      push_back (message) ;
      free (message) ;
   }
   
   //-------------------------------------------------------------------------
   
   /// front : code + int + string
   void AddFront(const int msg, const int intValue, const char * StrValue)
   {
      char * message ;

      if (StrValue == NULL)
      {
         message = (char*)malloc(17) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf_s(message, 17,"%5d%11d", msg, intValue);              // 5 + 11 + 1
         #else
         sprintf(message, "%5d%11d", msg, intValue);              // 5 + 11 + 1
         #endif
      } else {
         int mess_len = 17+strlen(StrValue) ;
         message = (char*)malloc(mess_len) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)   // visual studio 2005 : deprecated function
         sprintf_s(message,mess_len, "%5d%11d%s" , msg, intValue, StrValue);  // 5 + 11 + xxx + 1
         #else
         sprintf(message, "%5d%11d%s", msg, intValue, StrValue);  // 5 + 11 + xxx + 1
         #endif
      }
      push_front (message) ;
      free (message) ;
  }
   
   //-------------------------------------------------------------------------
   /// back : code + int + int + int + string  
   void Add(const int msg, const int int1, const int int2 , const int int3 , const char * StrValue)
   {
      char * message ;

      if (StrValue == NULL)
      {
         message = (char*)malloc(39) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf_s(message,39, "%5d%11d%11d%11d", msg, int1, int2 , int3);               // 5 + 11 + 11 + 11 + 1
         #else
         sprintf(message, "%5d%11d%11d%11d", msg, int1, int2 , int3);               // 5 + 11 + 11 + 11 + 1
         #endif
      } else {
         int mess_len = 39+strlen(StrValue) ;
         message = (char*)malloc(mess_len) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf_s(message, mess_len, "%5d%11d%11d%11d%s", msg, int1, int2 , int3 , StrValue);  // 5 + 11 + 11 + 11 + xxx + 1
         #else
         sprintf(message, "%5d%11d%11d%11d%s", msg, int1, int2 , int3 , StrValue);  // 5 + 11 + 11 + 11 + xxx + 1
         #endif
      }

      push_back (message) ;
      free (message) ;
 }
   //-------------------------------------------------------------------------
   /// back : code + int + int + int + int + string  
   void Add(const int msg, const int int1, const int int2 , const int int3 , const int int4 , const char * StrValue)
   {
      char * message ;

      if (value == NULL)
      {
         message = (char*)malloc(50) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf(message, "%5d%11d%11d%11d%11d", msg, int1, int2 , int3, int4);                // 5 + 11 + 11 + 11 + 11 + 1
         #else
         sprintf(message, "%5d%11d%11d%11d%11d", msg, int1, int2 , int3, int4);                // 5 + 11 + 11 + 11 + 11 + 1
         #endif
      } else {
         int messLen = 50+strlen(StrValue) ;
         message = (char*)malloc(messLen) ;
         #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE)  // visual studio 2005 : deprecated function
         sprintf_s(message,messLen, "%5d%11d%11d%11d%11d%s", msg, int1, int2 , int3 , int4, StrValue);   // 5 + 11 + 11 + 11 + 11 + xxx + 1
         #else
         sprintf(message, "%5d%11d%11d%11d%11d%s", msg, int1, int2 , int3 , int4, StrValue);   // 5 + 11 + 11 + 11 + 11 + xxx + 1
         #endif
      }

      push_back (message) ;
      free (message) ;           
   }

} ;

typedef CommandDeque<string> CommandList ;

//====================================================================================

/// <summary>
/// NodeContext is used internaly for the Indent and UnIndent functions.
/// </summary>

class NodeContext
{
public :
   DWORD threadId ;                        
   string nodeId ;                         
} ;

//====================================================================================

/// <summary>
/// Specify a font detail for traces columns items and members. 
/// </summary>

class FontDetail
{         
 public :
      int ColId  ;
      bool Bold  ;
      bool Italic ;
      int Color  ;    // -$7FFFFFFF-1..$7FFFFFFF;
      int Size   ;
      string FontName ;
} ;

//====================================================================================

/// <summary>
/// TMemberNode represent the informations displayed on the "Trace info panel" for a specific trace
/// </summary>

class TMemberNode
{
private :
   void _AddToStringList (CommandList * commands) ;
   deque <TMemberNode *> * m_Members ;          // sub members
   deque <FontDetail *> * m_FontDetails ;       // fonts
public :
   string col1 ;                                // Column 1
   string col2 ;                                // Column 2
   string col3 ;                                // Column 3
   int    tag ;                                 // User defined tag, NOT SEND to the viewer
   
   //-------------------------------------------------------------------------
   TMemberNode(const char    * strCol1 = NULL, const char    * strCol2 = NULL, const char    * strCol3 = NULL) ; // constructor
   TMemberNode(const wchar_t * strCol1       , const wchar_t * strCol2 = NULL, const wchar_t * strCol3 = NULL) ; // constructor

   ~TMemberNode() ;                                                                            // destructor
   deque <TMemberNode *> * Members() ;                                                         // sub members
   TMemberNode * Add (TMemberNode * member) ;                                                  // add a sub member
   TMemberNode * Add (const char    * strCol1, const char    * strCol2 = NULL, const char    * strCol3 = NULL);  // create and add a sub member
   TMemberNode * Add (const wchar_t * strCol1, const wchar_t * strCol2 = NULL, const wchar_t * strCol3 = NULL);  // create and add a sub member

   TMemberNode * SetFontDetail (const int ColId, const bool Bold , const bool Italic = false , const int Color = -1 , const int Size = 0 , const char * FontName = NULL) ;

   void AddToStringList (CommandList * commands) ;                                             // convert to command
} ;


//====================================================================================

/// <summary>
/// WinTrace represent a windows tree where you put traces
/// </summary>

class WinTrace
{
   friend TTrace ;   // TTrace use direct access to debug, warning and error
private :
   TraceNode * debug;
   TraceNode * warning;
   TraceNode * error;
   void init() ;
public :
   WinTrace (void) ;                                                 // constructor. Used to map to existing window
   WinTrace (const char    * winTraceID , const char    * winTraceTitle)  ;      // constructor. Used to create a new window
   WinTrace (const wchar_t * winTraceID , const wchar_t * winTraceTitle)  ;      // constructor. Used to create a new window
   ~WinTrace(void) ;                                                 // destructor
   
   TraceNode    * Debug()       { return debug   ;} ;                // Debug Node
   TraceNode    * Warning()     { return warning ;} ;                // Warning node
   TraceNode    * Error()       { return error   ;} ;                // Error node
   string id ; 	                                                   // Wintrace id (empty for the main window)
   int    tag ;                                                      // User defined tag, NOT SEND to the viewer

   void SaveToTextfile  (const char    * FileName) ;                 // Save the window tree traces to a text file
   void SaveToTextfile  (const wchar_t * FileName) ;                 // Save the window tree traces to a text file
   void SaveToXml       (const char    * FileName) ;                 // Save the window tree traces to an XML file
   void SaveToXml       (const wchar_t * FileName) ;                 // Save the window tree traces to an XML file
   void LoadXml         (const char    * FileName) ;                 // Load an XML file to the window tree traces
   void LoadXml         (const wchar_t * FileName) ;                 // Load an XML file to the window tree traces
   void SetLogFile      (const char    * FileName, int Mode) ;       // Set the log file.(Path is relative to the viewer)
   void SetLogFile      (const wchar_t * FileName, int Mode) ;       // Set the log file.(Path is relative to the viewer)
   void DisplayWin      () ;                                         // Show the window tree
   void SetMultiColumn  (const int MainColIndex = 0) ;               // change the tree to display user defined multiple columns
   void SetColumnsTitle (const char    * Titles) ;                   // set columns title
   void SetColumnsTitle (const wchar_t * Titles) ;                   // set columns title
   void SetColumnsWidth (const char    * Widths) ;                   // set columns width
   void SetColumnsWidth (const wchar_t * Widths) ;                   // set columns width
   void ClearAll () ;                                                // Clear all trace for the window tree
   

⌨️ 快捷键说明

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