当前位置:编程学习 > VC++ >>

VC资源文件版本解析类: (1) 头文件

 1#ifndef _RC_VERSION_H
 2#define _RC_VERSION_H
 3
 4#include <windows.h>
 5#include <tchar.h>
 6#include "..\mysdk\common\tstring.h"
 7
 8class CRCVersion
 9{
10    enum CharEncodeType
11    {
12    ANSI           ,
13        UNICODE_BIG    ,
14        UNICODE_LITTLE ,
15        UNKNOW        
16    };
17
18public:
19    CRCVersion();
20
21public:
22    static std::string    VerToStrA(ULONGLONG ullVer,char sep = '.');
23    static std::wstring   VerToStrW(ULONGLONG ullVer,wchar_t wsep = L'.');
24  static ULONGLONG StrToVerA(const std::string& strVer,char sep = '.');
25  static ULONGLONG StrToVerW(const std::wstring& wstrVer,wchar_t wsep = L'.');
26
27    #if (defined(_UNICODE)||defined(UNICODE))
28        #define VerToStr VerToStrW
29        #define StrToVer StrToVerW
30    #else
31        #define VerToStr VerToStrA
32        #define StrToVer StrToVerA   
33    #endif
34
35public:
36    bool  Open(LPCTSTR lpRCFile);
37    bool  Save();
38    void  Close();
39 
40    const tstring& GetCompanyName() const;
41    const tstring& GetProductName() const;
42    const tstring& GetCopyright() const;
43  const tstring& GetFileDesc() const;   
44    const tstring& GetInternalName() const;
45    const tstring& GetOriginalFilename() const;
46    void GetVersion(ULONGLONG* pullFileVer,ULONGLONG* pullProductVer) const;
47    void GetFileVer(ULONG* pulHigh,ULONG* pulLow) const;
48    void GetProductVer(ULONG* pulHigh,ULONG* pulLow) const;
49    void GetOtherVersion(ULONGLONG* pullFileVer,ULONGLONG* pullProductVer) const;
50  void GetOtherFileVer(ULONG* pulHigh,ULONG* pulLow) const;
51  void GetOtherProductVer(ULONG* pulHigh,ULONG* pulLow) const;
52
53  void SetVersion(ULONGLONG* pullFileVer,ULONGLONG* pullProductVer);
54    void SetOtherVersion(ULONGLONG* pullFileVer,ULONGLONG* pullProductVer);
55    void SetCompanyName(const tstring& tstrCompanyName);
56    void SetProductName(const tstring& tstrProductName);
57  void SetCopyright(const tstring& tstrCopyright);
58    void SetFileDesc(const tstring& tstrFileDesc);
59  void SetInternalName(const tstring& tstrInternalName);
60  void SetOriginalFileName(const tstring& tstrOriginalFileName);
61
62protected:
63    bool eof() const;
64  void getline(std::string& strLine) const;
65    void ParseCharEncode();
66    void ParseContent();
67    void ParseLine(std::string& strLine);
68    size_t ParseVersionInfo(const std::string& strLine,const std::string& strType, std::string& strVal);
69    size_t ParseBlockInfo(const std::string& strLine,const std::string& strType,std::string& strVal);
70    void SaveContent(HANDLE hFile);
71    void ChangeLine(std::string& strLine);
72  void ParseRC();
73   
74protected:
75  ULONGLONG m_ullFileVer;
76    ULONGLONG m_ullProductVer;
77  ULONGLONG m_ullOtherFileVer;
78  ULONGLONG m_ullOtherProductVer;
79  tstring   m_tstrCompanyName;
80    tstring   m_tstrProductName;
81    tstring   m_tstrCopyright;
82    tstring   m_tstrFileDesc;
83    tstring   m_tstrInternalName;
84    tstring   m_tstrOriginalFileName;
85
86private:
87  HANDLE    m_hFile;
88    tstring   m_tstrFileName;
89    int       m_nCharEncodeType;
90};
91
92#endif
 

作者“天道酬勤”
 

补充:软件开发 , Vc ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,