本文主要是介绍(P103)public模块介绍:public,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
文章目录
- 1.public
1.public
Convert
Date
Endian
Exception
Idea
MD5
JInStream/JOutStream
JThread
Logger/LogStream
Singleton
Socket
StringUtil
SystemConfig
Timestamp
- eg:P103\ABCBank\Public
int main()
{//日志类的使用//LOG_INFO<<"Entering main";//LOG_INFO<<"Do something";//LOG_INFO<<"Exiting main";JOutStream jos;string s1 = "abc";//调用JOutStream& JOutStream::operator<<(const std::string& str)string s2 = "xyz";//调用JOutStream& JOutStream::operator<<(const std::string& str)int x = 100;//调用JOutStream& JOutStream::operator<<(uint32 x)jos<<s1<<s2<<x; // 打包到输出流jos,得到字节流jos.Data()JInStream jis(jos.Data(), jos.Length());//解包string ss1;string ss2;int xx;jis>>ss1>>ss2>>xx;std::cout<<ss1<<" "<<ss2<<" "<<xx<<std::endl;return 0;
}
- 测试:Logger类
解包结果如下:
前2个字节存的是3
string s1 = "abc";//调用JOutStream& JOutStream::operator<<(const std::string& str)
3都是二进制的值
- 配置文件格式,SystemConfig类
eg:server.conf
[SERVER]
#SERVER_IP=192.168.0.188
#端口
PORT=8888[DB]
IP=localhost
#PORT=0表示默认端口3306
PORT=3306
USER=root
PASS=123456
NAME=bank[BANK]
#利率
INTEREST_RATE=0.0035
这篇关于(P103)public模块介绍:public的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!