|
Toshihiro Shimizu |
890ddd |
#ifndef igs_resource_msg_from_err_h
|
|
Toshihiro Shimizu |
890ddd |
#define igs_resource_msg_from_err_h
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <string></string>
|
|
Toshihiro Shimizu |
890ddd |
#include "igs_os_type.h" /* TCHAR,TEXT(),... */
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define igs_tostr(n) igs_tostr_(n) /* __LINE__ --> 56 */
|
|
Toshihiro Shimizu |
890ddd |
#define igs_tostr_(n) #n /* 56 --> "56" */
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef IGS_RESOURCE_LOG_EXPORT
|
|
Toshihiro Shimizu |
890ddd |
#define IGS_RESOURCE_LOG_EXPORT
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*------ 文字コード変換 --------------------------------------------*/
|
|
Toshihiro Shimizu |
890ddd |
namespace igs
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
namespace resource
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
/*--- localeを日本に設定し日本語を扱うことを指示 ---*/
|
|
Toshihiro Shimizu |
890ddd |
IGS_RESOURCE_LOG_EXPORT void locale_to_jp(void);
|
|
Toshihiro Shimizu |
890ddd |
/*--- マルチバイト文字列 --> ワイド文字文字列 ---*/
|
|
Toshihiro Shimizu |
890ddd |
IGS_RESOURCE_LOG_EXPORT void mbs_to_wcs(
|
|
Toshihiro Shimizu |
890ddd |
const std::string &mbs, std::wstring &wcs);
|
|
Toshihiro Shimizu |
890ddd |
/*--- ワイド文字文字列 --> マルチバイト文字列 ---*/
|
|
Toshihiro Shimizu |
890ddd |
IGS_RESOURCE_LOG_EXPORT void wcs_to_mbs(
|
|
Toshihiro Shimizu |
890ddd |
const std::wstring &wcs, std::string &mbs);
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
2012-08-22 呼び側の名前も変更
|
|
Toshihiro Shimizu |
890ddd |
from_mbcs(-) --> ts_from_mbs(-)
|
|
Toshihiro Shimizu |
890ddd |
mbcs_from(-) --> mbs_from_ts(-)
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
/*--- UNICODE宣言ならマルチバイト文字列をワイド文字文字列に変換 ---*/
|
|
Toshihiro Shimizu |
890ddd |
const std::basic_string<tchar> ts_from_mbs(const std::string &mbs);</tchar>
|
|
Toshihiro Shimizu |
890ddd |
/*--- UNICODE宣言ならワイド文字文字列をマルチバイト文字列に変換 ---*/
|
|
Toshihiro Shimizu |
890ddd |
const std::string mbs_from_ts(const std::basic_string<tchar> &ts);</tchar>
|
|
Toshihiro Shimizu |
890ddd |
/*--- cp932を含む文字列をutf-8に変換(mbcsのみ) ---*/
|
|
Toshihiro Shimizu |
890ddd |
const std::string utf8_from_cp932_mb(const std::string &text);
|
|
Toshihiro Shimizu |
890ddd |
/*--- utf-8を含む文字列をcp932に変換(mbcsのみ) ---*/
|
|
Toshihiro Shimizu |
890ddd |
const std::string cp932_from_utf8_mb(const std::string &text);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*------ エラーメッセージ表示 --------------------------------------*/
|
|
Toshihiro Shimizu |
890ddd |
namespace igs
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
namespace resource
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
const std::string msg_from_err_(/* 直によんではいけない */
|
|
Toshihiro Shimizu |
890ddd |
const std::basic_string<tchar> &tit, const int erno, const std::string &file, const std::string &line, const std::string &pretty_function, const std::string &comp_type, const std::string &gnuc, const std::string &gnuc_minor, const std::string &gnuc_patchlevel, const std::string &gnuc_rh_release, const std::string &date, const std::string &time);</tchar>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
/*--- errno値からエラーメッセージを得る ---*/
|
|
Toshihiro Shimizu |
890ddd |
#define igs_resource_msg_from_err(tit, erno) igs::resource::msg_from_err_(tit, erno, __FILE__, igs_tostr(__LINE__), __PRETTY_FUNCTION__, igs_tostr_(__GNUC__), igs_tostr(__GNUC__), igs_tostr(__GNUC_MINOR__), igs_tostr(__GNUC_PATCHLEVEL__), igs_tostr(__GNUC_RH_RELEASE__), __DATE__, __TIME__)
|
|
Toshihiro Shimizu |
890ddd |
/*--- エラーメッセージを得る ---*/
|
|
Toshihiro Shimizu |
890ddd |
#define igs_resource_msg_from_er(tit) igs::resource::msg_from_err_(tit, 0, __FILE__, igs_tostr(__LINE__), __PRETTY_FUNCTION__, igs_tostr_(__GNUC__), igs_tostr(__GNUC__), igs_tostr(__GNUC_MINOR__), igs_tostr(__GNUC_PATCHLEVEL__), igs_tostr(__GNUC_RH_RELEASE__), __DATE__, __TIME__)
|
|
Toshihiro Shimizu |
890ddd |
#endif /* !igs_resource_msg_from_err_h */
|