最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

Poco入门介绍

IT圈 admin 38浏览 0评论

2024年2月14日发(作者:汗雪风)

Poco入门介绍

库简介

官方网站: /

POCO C++库是开源的用于简化和加速C++开发面向网络、可移植应用程序的C++库集,POCO库和C++标准库可以很好的集成并填补了C++标准库缺乏的功能空隙。POCO库的模块化、高效的设计及实现使得POCO特别适合嵌入式开发。

核心库是: Foundation, XML, Util 和 Net. 附加库中其中2个是NetSSL和Data,NetSSL为Net库中的网络类提供SSL支持, Data库提供访问不同SQL数据库的一致性接口

支持的平台:

Microsoft Windows

Linux

Mac OS X

HP-UX,Solaris,AIX*

Embedded Linux(UcLibc,glibc)

iOS

Winodows Embedded CE

QNX

1

2.常用功能点

> Any and DynamicAny classes

> Cache framework

> Cryptography (cryptographic hashes, encryption based on OpenSSL)

> Date and Time classes

> Events (signal/slot mechanism) and notifications framework

> FTP client for transferring files

> Filesystem classes for platform-independent path manipulation,directory listing and globing

> HTML form handling

> HTTP server and client (also secure), C++ Server Page Compiler

> Logging framework

> Multithreading: basic threads and synchronization and advanced facilities (thread pool, active

objects, work queues, etc.)

> POP3 client for receiving mail

> Platform Abstraction: write once, compile and run on multiple platforms

> Processes and IPC

> Reactor framework

> Regular expressions (based on PCRE)

> SMTP client for sending mail

> SQL database access (SQLite, MySQL, ODBC)

> SSL/TLS support based on OpenSSL

> Shared library and class loading

> Smart pointers and memory management (buffer, pool)

> Sockets and raw sockets

> Stream classes for Base64 and HexBinary encoding/decoding, compression (zlib), line ending

conversion, reading/writing to

memory, etc

> String formatting and string utilities

> TCP server framework (multithreaded)

> Text encodings and conversions

> Tuples

> URI handling

> UTF-8 and Unicode support

> UUID handling and generation

> XML parsing (SAX2 and DOM) and XML generation

> Zip file manipulation

2

库代码结构预览:

build/ the build system for Unix/OpenVMS and additional

utility scripts

config/ build configurations for various Unix platforms

rules/ common build rules for all platforms

scripts/ build and utility scripts

vms/ OpenVMS build system scripts

bin/ all executables (dynamic link libraries on Windows)

doc/ additional documentation

lib/ all libraries (import libraries on Windows)

C的

CppUnit/ project and make/build files for the CppUnit unit

testing framework

doc/ additional documentation

include/

CppUnit/ header files for CppUnit

src/ source files for CppUnit

WinTestRunner/ Windows GUI for CppUnit

Foundation/ project and make/build files for the Foundation

library

include/

Poco/ header files for the Foundation library

src/ source files for the Foundation library

testsuite/ project and make/build files for the Foundation

testsuite

src/ source files for the Foundation testsuite

bin/ test suite executables

samples/ sample applications for the Foundation library

XML/ project and make/build files for the XML library

include/

Poco/

XML/ header files for the core XML library

SAX/ header files for SAX support

DOM/ header files for DOM support

src/ source files for the XML library

testsuite/ project and make/build files for the XML testsuite

src/ source files for the XML testsuite

3

bin/ test suite executables

samples/ sample applications for the XML library

Net/ project and make/build files for the Net library

include/

Poco/

Net/ header files for the Net library

src/ source files for the Net library

testsuite/ project and make/build files for the Net testsuite

src/ source files for the Net testsuite

bin/ test suite executables

samples/ sample applications for the Net library

2.编译安装

2.1 windows下的编译安装

2.1.1 Visual Studio 2008 下的编译安装

---省略演示

2.1.2 Eclipse 下的编译安装

---演示为主

1.安装MinGW+msys cygwin

2.安装eclipse

3.设置eclipse编译工具链

2.2 unix/linux平台下的编译安装

主要步骤如下:

1. 检查gmake 是否安装

[xiaohai@fedora12 ~]$ whereis gmake

gmake: /usr/bin/gmake /usr/share/man/man1/

[xiaohai@fedora12 ~]$ gmake -v

GNU Make 3.81

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

4

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

This program built for i386-redhat-linux-gnu

[xiaohai@fedora12 ~]$

2. 设置环境变量

Echo $POCO_BASE

orld 开发自己的第一个应用

3.1构建自己的工程

a.创建工程目录hellWorld

b.创建目录include src 目录

helloWorld

/include

/src

Makefile

c. 创建文件

3.2编写Makefile

#

# Makefile

#

# $Id: //poco/1.3/samples/helloWorld/Makefile#1 $

#

# Makefile for helloWorld

#

include $(POCO_BASE)/build/rules/global

objects = helloWorld

target = helloWorld

target_version = 2.1

5

target_libs = PocoFoundation

include $(POCO_BASE)/build/rules/exec

警告:

Objects,target,target_version,target_libs变量最末尾一定不能有空格,否则编译会出现异常

3.3 编译

Gmake shared_release

3.4 运行

3.5 调试

4.核心模块介绍

4.1.跨平台编译包

编译脚本目录$POCO_BASE/build

Global 文件解释:

#

# $Id: //poco/1.3/build/rules/global#10 $

#

# global

#

# Global build configuration

#

# Environment variables:

# POCO_BASE: Path to POCO source tree. Must be defined.

6

# POCO_BUILD: Path to directory where build files are put.

# Defaults to $(POCO_BASE)

# POCO_CONFIG: Build configuration to use.

# Defaults to `uname`.

# POCO_TARGET_OSNAME: Target system operating system name (for cross builds)

# POCO_TARGET_OSARCH: Target system architecture (forr cross builds)

#

#

# Check for POCO_BASE

#

ifndef POCO_BASE

$(error POCO_BASE is not defined.)

endif

#

# Include some optional make configuration

#

sinclude $(POCO_BASE)/

#

# Check for PROJECT_BASE

#

ifndef PROJECT_BASE

PROJECT_BASE = $(POCO_BASE)

Endif

export PROJECT_BASE

#

# Check for POCO_BUILD

#

ifndef POCO_BUILD

POCO_BUILD = $(PROJECT_BASE)

endif

export POCO_BUILD

#

# POCO_BASE/POCO_BUILD/cwd sanity checks

#

# Ensure that the current working directory is either

# under $POCO_BASE or under $PROJECT_BASE

# Also, if we're building under $POCO_BASE, disarm

# $PROJECT_BASE

7

#

cwd = $(shell pwd)

inpoco = $(shell echo | awk '{print index("$(cwd)","$(POCO_BASE)")}')

inproj = $(shell echo | awk '{print index("$(cwd)","$(PROJECT_BASE)")}')

ifeq ($(inpoco),1)

PROJECT_BASE = $(POCO_BASE)

else

ifeq ($(inproj),1)

else

$(error Current working directory not under $$PROJECT_BASE)

endif

endif

#

# Determine OS

#

POCO_HOST_OSNAME = $(shell uname)

ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN)

POCO_HOST_OSNAME = CYGWIN

endif

ifeq ($(findstring MINGW,$(POCO_HOST_OSNAME)),MINGW)

POCO_HOST_OSNAME = MinGW

endif

POCO_HOST_OSARCH = $(subst /,-,$(shell uname -m | tr ' ' _))

#

# Begin Sun platforms

#

# Pure Solaris or GNU (Nexenta), Sun Forte and Sun Studio compilers supported

# (on Nexenta, the default compiler is g++)

#

ifeq ($(findstring SunOS,$(POCO_HOST_OSNAME)),SunOS)

# detect if this is Nexenta platform

POCO_HOST_ALL_OSNAME := $(shell uname -a)

ifeq ($(findstring Nexenta,$(POCO_HOST_ALL_OSNAME)),Nexenta)

POCO_HOST_OSNAME := Nexenta

else # Up to version 5.5 SunOS-SunForte config is used, 5.6 and above use SunOS-SunStudio

POCO_COMPILER_NAME := $(shell CC -V 2>&1)

POCO_COMPILER_VERSION := $(subst .,,$(filter 5.%,$(POCO_COMPILER_NAME)))

ifeq (0, $(shell test $(POCO_COMPILER_VERSION) -gt 55; echo $$?))

POCO_CONFIG := SunOS-SunStudio

else

8

POCO_CONFIG := SunOS-SunForte

endif

endif

endif

#

# End Sun Platforms

#

#

# If POCO_CONFIG is not set, use the OS name as configuration name

#

ifndef POCO_CONFIG

POCO_CONFIG = $(POCO_HOST_OSNAME)

endif

#

# Check if a 64bit build is requested

#

ifndef OSARCH_64BITS

OSARCH_64BITS = 0

endif

ifeq ($(OSARCH_64BITS),1)

OSARCH_POSTFIX = 64

else

OSARCH_POSTFIX =

endif

#

# Include System Specific Settings

#

include $(POCO_BASE)/build/config/$(POCO_CONFIG)

#

# Determine operating system

#

ifndef POCO_TARGET_OSNAME

OSNAME := $(POCO_HOST_OSNAME)

else

OSNAME := $(POCO_TARGET_OSNAME)

endif

ifndef POCO_TARGET_OSARCH

OSARCH := $(subst /,-,$(shell uname -m | tr ' ' _))

else

9

OSARCH := $(POCO_TARGET_OSARCH)

endif

HOSTNAME := $(shell hostname)

#

# Find out current component

#

COMPONENT := $(shell $(POCO_BASE)/build/script/projname "$(PROJECT_BASE)")

#

# Define standard directories

#

SRCDIR = src

INCDIR = include

LIBDIR = lib/$(OSNAME)/$(OSARCH)

BINDIR = bin/$(OSNAME)/$(OSARCH)

OBJDIR = obj/$(OSNAME)/$(OSARCH)

DEPDIR = .dep/$(OSNAME)/$(OSARCH)

LIBPATH = $(POCO_BUILD)/$(LIBDIR)

BINPATH = $(POCO_BUILD)/$(COMPONENT)/$(BINDIR)

OBJPATH = $(POCO_BUILD)/$(COMPONENT)/$(OBJDIR)

DEPPATH = $(POCO_BUILD)/$(COMPONENT)/$(DEPDIR)

ifeq ($(POCO_BASE),$(PROJECT_BASE))

POCO_LIBRARY =

else

POCO_LIBRARY = -L$(POCO_BASE)/$(LIBDIR)

endif

ifndef LIBPREFIX

LIBPREFIX = lib

endif

#

# Build component list

#

COMPONENTS := $(shell cat $(POCO_BASE)/components)

#

# Read global library version number

#

LIBVERSION := $(shell cat $(POCO_BASE)/libversion)

#

10

# Determine link mode

#

ifndef LINKMODE

LINKMODE = BOTH

endif

ifeq ($(LINKMODE),SHARED)

DEFAULT_TARGET = all_shared

endif

ifeq ($(LINKMODE),STATIC)

DEFAULT_TARGET = all_static

endif

ifeq ($(LINKMODE),BOTH)

DEFAULT_TARGET = all_static all_shared

endif

#

# Compose compiler flags

#

COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)

CFLAGS += $(COMMONFLAGS) $(SYSFLAGS)

CXXFLAGS += $(COMMONFLAGS) $(SYSFLAGS)

LINKFLAGS += $(COMMONFLAGS) $(SYSFLAGS)

ifeq ($(OSARCH_64BITS),1)

CFLAGS += $(CFLAGS64)

CXXFLAGS += $(CXXFLAGS64)

SHLIBFLAGS += $(SHLIBFLAGS64)

DYLIBFLAGS += $(DYLIBFLAGS64)

LINKFLAGS += $(LINKFLAGS64)

else

CFLAGS += $(CFLAGS32)

CXXFLAGS += $(CXXFLAGS32)

SHLIBFLAGS += $(SHLIBFLAGS32)

DYLIBFLAGS += $(DYLIBFLAGS32)

LINKFLAGS += $(LINKFLAGS32)

endif

#

# Compose object file path

#

OBJPATH_RELEASE_STATIC = $(OBJPATH)/release_static$(OSARCH_POSTFIX)

OBJPATH_DEBUG_STATIC = $(OBJPATH)/debug_static$(OSARCH_POSTFIX)

OBJPATH_RELEASE_SHARED = $(OBJPATH)/release_shared$(OSARCH_POSTFIX)

11

OBJPATH_DEBUG_SHARED = $(OBJPATH)/debug_shared$(OSARCH_POSTFIX)

#

# Build Include directory List

#

INCLUDE = $(foreach p,$(POCO_ADD_INCLUDE),-I$(p)) -Iinclude $(foreach

p,$(COMPONENTS),-I$(POCO_BASE)/$(p)/$(INCDIR))

#

# Build Library Directory List

#

LIBRARY = $(foreach p,$(POCO_ADD_LIBRARY),-L$(p)) -L$(LIBPATH) $(POCO_LIBRARY)

#

# Strip Command definition

#

ifeq ($(strip $(STRIP)),)

STRIPCMD =

else

STRIPCMD = $(STRIP) $@$(BINEXT)

endif

#

# Remote debugging support

#

ifeq ($(strip $(STRIPDBG)),)

CPYDBG =

STRIPDBGCMD =

else

CPYDBG = cp $@ $@x

STRIPDBGCMD = $(STRIP) $@x

endif

#

# Make CC and CXX environment vars

#

export CC

export CXX

常见的修改:

POCO_BASE 定义poco代码目录

OSARCH_64BITS =1 定义64位编译模式

SRCDIR = src makefile与.cpp的位置

12

INCDIR = include .h文件夹

LIBDIR = lib lib文件夹

BINDIR = bin bin文件夹

OBJDIR = obj/$(OSNAME)/$(OSARCH)

DEPDIR = .dep/$(OSNAME)/$(OSARCH)

LIBPATH = $(POCO_BUILD)/$(LIBDIR)

BINPATH = $(POCO_BUILD)/$(COMPONENT)/$(BINDIR) -->建议改为 $(BINDIR)

OBJPATH = $(POCO_BUILD)/$(COMPONENT)/$(OBJDIR)-->可以不用管)$(OBJDIR)

DEPPATH = $(POCO_BUILD)/$(COMPONENT)/$(DEPDIR)-->依赖文件目录)$(DEPDIR)

系统自带的编译指令:

all: $(DEFAULT_TARGET)

all_static: static_debug static_release

all_shared: shared_debug shared_release

all_debug: static_debug shared_debug

all_release: static_release shared_release

自定义编译指令:

CFLAGS += -g

CXXFLAGS += -g

POCO_FLAGS +=

COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)

添加额外的头文件路径:

POCO_ADD_INCLUDE += $(ORACLE_HOME)/precomp/public $(ORACLE_HOME)/rdbms/public

$(ORACLE_HOME)/rdbms/demo

POCO_ADD_LIBRARY +=$(ORACLE_HOME)/$(OraLib)

添加额外的链接库非POCO编译出来的库

SYSLIBS +=-locci -lclntsh

编译方式:

gmake shared_release

gmake shared_debug

gmake static_release

gmake static_debug

gmake all_release

gmake all_debug

gmake all

13

tion库

4.2.1 core 模块

rm abstraction

1.统一了各个平台的数据类型比如 long ,int ,long long 等 ,参考types.h

2.平台的big-endian和little-endian 参考ByteOrder.h

3.平台类型相关信息platform.h

b. Memory Management

1.智能指针(smart pointer)和共享指针(shared pointer) 参考AutoPtr.h,SharedPtr.h

2.据以引用计数器的垃圾回收机制 AtomicCounter.h,refCountedObject.h

3.单件类(singleton objects) SingletonHolder.h

Utilities

字符串的比较(大小写转换,大小写无关转换,去除空白符号,字符转换和连接,分拆),

参考String.h,StringTokenizer.h

Handling

1. 断言类,类似assert,主要使用宏断言,比如poco_asert(myPtr);参考Bugcheck.h

2.异常类, 了解Poco::exception结构,使用POCO_DECLARE_EXCEPTION宏,参考Exception.h

14

s

pass

ing

pass

me

amp 微秒级精度,对gettimeofday()封装,参考Timestamp.h

tch 计时器,参考Stopwatch.h

me 日历时间,参考DateTime.h

d.日历时间的格式转换DateTimeFormat,DateTimeFormatter,DateTimeParser等

e.日历时区Timezone

f.本地时间LocalDateTime

4.2.5 FileSystem

与平台无关的文件,目录的操作类。

a. File类,读取文件的相关信息,比如权限,大小,日期,文件的删除,拷贝等

b. Path 类, 文件目录的解析,目录创建等

c. DirectoryIterator类,遍历指定目录下的文件列表

d. TemporaryFile 类,临时文件创建,删除等

4.2.6 Logging

可以输出到多个目的地(console,log files,Unix Syslog,Windows Event Log,remote logging)

主要是定义日志文件格式

# This is a sample configuration file.

=E:workspace

#定义日志层次结构

15

= ConsoleChannel

= global

=SplitterChannel

ls=c1,logfile

#日志p

=p

#l=file2

me=${}${}.log

#定义日志格式

= PatternFormatter

=local

n =

[%y/%m/%d %H:%M:%S][${}][%q]-%t

#定义日志输出地,输出地 名称 输出的格式

= ConsoleChannel

ter =formatter1

=FileChannel

=local

ter=formatter1

=${}/Download/${}_${}.log

#rotation

on=daily

#file2

=FileChannel

=local

#archive number|timestamp

e=number

=FileChannel

ter=formatter1

=${}_${}_

on=daily

ss=true

#purge purgeAge|purgeCount

16

ge=3 minutes

#ount=6

= debug

= SplitterChannel

///以channel开头的属性

l1 = consoleChannel

l2 = fileChannel

也可以配置成

ls=consoleChannel,fileChannel

///定义控制台通道

= ConsoleChannel

ter = f1

///定义文件通道

= FileChannel

=

= PatternFormattern"

n

= %Y-%m-%d %H:%M:%S,%i [%I] %p %s - %t

///定义消息格式

= PatternFormatter

n = %s-[%p] %t

17

= UTC

4.2.7 Processes

4.2.8 Shared Libraries

4.2.9 Notifications

4.2.10 Event

4.2.11 Crypt

4.2.12 Text

4.2.13 Regular Expressions

将下一个字符标记为一个特殊字符、或一个原义字符、或一个后向引用、或一个八进制转义符。

^ 匹配输入字符串的开始位置。如果设置了 RegExp 对象的Multiline 属性,^ 也匹配 ’n’ 或 ’r’ 之后的位置。

$ 匹配输入字符串的结束位置。如果设置了 RegExp 对象的Multiline 属性,$ 也匹配 ’n’ 或 ’r’ 之前的位置。

18

* 匹配前面的子表达式零次或多次。

+ 匹配前面的子表达式一次或多次。+ 等价于 {1,}。

? 匹配前面的子表达式零次或一次。? 等价于 {0,1}。

{n} n 是一个非负整数,匹配确定的n 次。

{n,} n 是一个非负整数,至少匹配n 次。

{n,m} m 和 n 均为非负整数,其中n <= m。最少匹配 n 次且最多匹配 m 次。在逗号和两个数之间不能有空格。

? 当该字符紧跟在任何一个其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面时,匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串,而默认的贪婪模式则尽可能多的匹配所搜索的字符串。

. 匹配除 "n" 之外的任何单个字符。要匹配包括 ’n’ 在内的任何字符,请使用象 ’[.n]’ 的模式.

(pattern) 匹配pattern 并获取这一匹配.

(?Ppattern)匹配pattern,匹配后goup可以用name代替数字(1) -> ('name').

(?:pattern) 匹配pattern 但不获取匹配结果,也就是说这是一个非获取匹配,不进行存储供以后使用。

(?=pattern) 正向预查,在任何匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。

(?!pattern) 负向预查,与(?=pattern)作用相反

x|y 匹配 x 或 y。

[xyz] 字符集合。

[^xyz] 负值字符集合。

[a-z] 字符范围,匹配指定范围内的任意字符。

[^a-z] 负值字符范围,匹配任何不在指定范围内的任意字符。

b 匹配一个单词边界,也就是指单词和空格间的位置。

B 匹配非单词边界。

cx 匹配由x指明的控制字符。

19

d 匹配一个数字字符。等价于 [0-9]。

D 匹配一个非数字字符。等价于 [^0-9]。

f 匹配一个换页符。等价于 x0c 和 cL。

n 匹配一个换行符。等价于 x0a 和 cJ。

r 匹配一个回车符。等价于 x0d 和 cM。

s 匹配任何空白字符,包括空格、制表符、换页符等等。等价于[ fnrtv]。

S 匹配任何非空白字符。等价于 [^ fnrtv]。

t 匹配一个制表符。等价于 x09 和 cI。

v 匹配一个垂直制表符。等价于 x0b 和 cK。

w 匹配包括下划线的任何单词字符。等价于’[A-Za-z0-9_]’。

W 匹配任何非单词字符。等价于 ’[^A-Za-z0-9_]’。

xn 匹配 n,其中 n 为十六进制转义值。十六进制转义值必须为确定的两个数字长。

num 匹配 num,其中num是一个正整数。对所获取的匹配的引用。

n 标识一个八进制转义值或一个后向引用。如果 n 之前至少 n 个获取的子表达式,则 n 为后向引用。否则,如果 n 为八进制数字 (0-7),则 n 为一个八进制转义值。

nm 标识一个八进制转义值或一个后向引用。如果 nm 之前至少有 is preceded by at least nm 个获取得子表达式,则 nm 为后向引用。如果 nm 之前至少有 n 个获取,则 n 为一 个后跟文字 m 的后向引用。如果前面的条件都不满足,若 n 和 m 均为八进制数字 (0-7),则 nm 将匹配八进制转义值 nm。

nml 如果 n 为八进制数字 (0-3),且 m 和 l 均为八进制数字 (0-7),则匹配八进制转义值 nml。

un 匹配 n,其中 n 是一个用四个十六进制数字表示的Unicode字符。

Xml解析器是对expat解析库的包装。

20

FTPClient HTML HTTP HTTPClient

HTTPServer ICMP Logging Mail

NetCore Reactor Sockets TCPServer

4.4.1 NetCore

为其它网络应用提供核心功能组件,比如 network address,DNS类

DNS类提供DNS解析功能

IPAddress类提供IP地址转换解析类

NetException类网络操作异常基础类

SocketAddress类由IP地址加端口号组成

4.4.2 Sockets

4.4.3 Reactor

4.4.4 HTTP

4.4.5 FTP

21

Net

4.4.6 Mail

4.4.7 HTML

主要是配置文件(ini,xml,properties)解析类,命令行参数解析类,以及构建命令行工具的框架类

4.5.1 Configuration files

提供了一个访问各类配置文件格式的接口,可以支持Java-style的property文件,windows风格的.ini文件以及XML文件

4.5.2 Command Line Options

处理与平台无关的命令行参数.例如在unix平台上参数都是以-或者—开头的,在windows平台参数选项以/开头。

ion(

Option("help", "h", "display help information on command line arguments")

.required(false)

.repeatable(false)

22

.callback(OptionCallback(this, &SampleApp::handleHelp)));

ion(

Option("define", "D", "define a configuration property")

.required(false)

.repeatable(true)

.argument("name=value")

.callback(OptionCallback(this, &SampleApp::handleDefine)));

ion(

Option("config-file", "f", "load configuration data from a file")

.required(false)

.repeatable(true)

.argument("file")

.callback(OptionCallback(this, &SampleApp::handleConfig))); --设置回调函数

ion(

Option("bind", "b", "bind option value to ty")

.required(false)

.repeatable(false)

.argument("value")

.binding("")); --- 相当于设置=value中的值,那么在其他的地方就可以引用

选项有如下属性:

full name : 长名字

short name 短名字

description:描述信息

optional|required 可选或者必选

repeatable:是否可以重复选择

1也选项可以成为一个选项组的一部分

选项可以绑定到配置属性中,这样配置属性就可以自动接受参数值

回调函数处理 当选择被指定 那么就处理该回调函数

选项验证信息

23

4.5.3 Tools and Server Applications

基于命令行工具和服务应用程序的框架。服务应用在Unix平台上实现为daemon,在windows平台上运行为服务

5.开发规范

24

2024年2月14日发(作者:汗雪风)

Poco入门介绍

库简介

官方网站: /

POCO C++库是开源的用于简化和加速C++开发面向网络、可移植应用程序的C++库集,POCO库和C++标准库可以很好的集成并填补了C++标准库缺乏的功能空隙。POCO库的模块化、高效的设计及实现使得POCO特别适合嵌入式开发。

核心库是: Foundation, XML, Util 和 Net. 附加库中其中2个是NetSSL和Data,NetSSL为Net库中的网络类提供SSL支持, Data库提供访问不同SQL数据库的一致性接口

支持的平台:

Microsoft Windows

Linux

Mac OS X

HP-UX,Solaris,AIX*

Embedded Linux(UcLibc,glibc)

iOS

Winodows Embedded CE

QNX

1

2.常用功能点

> Any and DynamicAny classes

> Cache framework

> Cryptography (cryptographic hashes, encryption based on OpenSSL)

> Date and Time classes

> Events (signal/slot mechanism) and notifications framework

> FTP client for transferring files

> Filesystem classes for platform-independent path manipulation,directory listing and globing

> HTML form handling

> HTTP server and client (also secure), C++ Server Page Compiler

> Logging framework

> Multithreading: basic threads and synchronization and advanced facilities (thread pool, active

objects, work queues, etc.)

> POP3 client for receiving mail

> Platform Abstraction: write once, compile and run on multiple platforms

> Processes and IPC

> Reactor framework

> Regular expressions (based on PCRE)

> SMTP client for sending mail

> SQL database access (SQLite, MySQL, ODBC)

> SSL/TLS support based on OpenSSL

> Shared library and class loading

> Smart pointers and memory management (buffer, pool)

> Sockets and raw sockets

> Stream classes for Base64 and HexBinary encoding/decoding, compression (zlib), line ending

conversion, reading/writing to

memory, etc

> String formatting and string utilities

> TCP server framework (multithreaded)

> Text encodings and conversions

> Tuples

> URI handling

> UTF-8 and Unicode support

> UUID handling and generation

> XML parsing (SAX2 and DOM) and XML generation

> Zip file manipulation

2

库代码结构预览:

build/ the build system for Unix/OpenVMS and additional

utility scripts

config/ build configurations for various Unix platforms

rules/ common build rules for all platforms

scripts/ build and utility scripts

vms/ OpenVMS build system scripts

bin/ all executables (dynamic link libraries on Windows)

doc/ additional documentation

lib/ all libraries (import libraries on Windows)

C的

CppUnit/ project and make/build files for the CppUnit unit

testing framework

doc/ additional documentation

include/

CppUnit/ header files for CppUnit

src/ source files for CppUnit

WinTestRunner/ Windows GUI for CppUnit

Foundation/ project and make/build files for the Foundation

library

include/

Poco/ header files for the Foundation library

src/ source files for the Foundation library

testsuite/ project and make/build files for the Foundation

testsuite

src/ source files for the Foundation testsuite

bin/ test suite executables

samples/ sample applications for the Foundation library

XML/ project and make/build files for the XML library

include/

Poco/

XML/ header files for the core XML library

SAX/ header files for SAX support

DOM/ header files for DOM support

src/ source files for the XML library

testsuite/ project and make/build files for the XML testsuite

src/ source files for the XML testsuite

3

bin/ test suite executables

samples/ sample applications for the XML library

Net/ project and make/build files for the Net library

include/

Poco/

Net/ header files for the Net library

src/ source files for the Net library

testsuite/ project and make/build files for the Net testsuite

src/ source files for the Net testsuite

bin/ test suite executables

samples/ sample applications for the Net library

2.编译安装

2.1 windows下的编译安装

2.1.1 Visual Studio 2008 下的编译安装

---省略演示

2.1.2 Eclipse 下的编译安装

---演示为主

1.安装MinGW+msys cygwin

2.安装eclipse

3.设置eclipse编译工具链

2.2 unix/linux平台下的编译安装

主要步骤如下:

1. 检查gmake 是否安装

[xiaohai@fedora12 ~]$ whereis gmake

gmake: /usr/bin/gmake /usr/share/man/man1/

[xiaohai@fedora12 ~]$ gmake -v

GNU Make 3.81

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

4

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

This program built for i386-redhat-linux-gnu

[xiaohai@fedora12 ~]$

2. 设置环境变量

Echo $POCO_BASE

orld 开发自己的第一个应用

3.1构建自己的工程

a.创建工程目录hellWorld

b.创建目录include src 目录

helloWorld

/include

/src

Makefile

c. 创建文件

3.2编写Makefile

#

# Makefile

#

# $Id: //poco/1.3/samples/helloWorld/Makefile#1 $

#

# Makefile for helloWorld

#

include $(POCO_BASE)/build/rules/global

objects = helloWorld

target = helloWorld

target_version = 2.1

5

target_libs = PocoFoundation

include $(POCO_BASE)/build/rules/exec

警告:

Objects,target,target_version,target_libs变量最末尾一定不能有空格,否则编译会出现异常

3.3 编译

Gmake shared_release

3.4 运行

3.5 调试

4.核心模块介绍

4.1.跨平台编译包

编译脚本目录$POCO_BASE/build

Global 文件解释:

#

# $Id: //poco/1.3/build/rules/global#10 $

#

# global

#

# Global build configuration

#

# Environment variables:

# POCO_BASE: Path to POCO source tree. Must be defined.

6

# POCO_BUILD: Path to directory where build files are put.

# Defaults to $(POCO_BASE)

# POCO_CONFIG: Build configuration to use.

# Defaults to `uname`.

# POCO_TARGET_OSNAME: Target system operating system name (for cross builds)

# POCO_TARGET_OSARCH: Target system architecture (forr cross builds)

#

#

# Check for POCO_BASE

#

ifndef POCO_BASE

$(error POCO_BASE is not defined.)

endif

#

# Include some optional make configuration

#

sinclude $(POCO_BASE)/

#

# Check for PROJECT_BASE

#

ifndef PROJECT_BASE

PROJECT_BASE = $(POCO_BASE)

Endif

export PROJECT_BASE

#

# Check for POCO_BUILD

#

ifndef POCO_BUILD

POCO_BUILD = $(PROJECT_BASE)

endif

export POCO_BUILD

#

# POCO_BASE/POCO_BUILD/cwd sanity checks

#

# Ensure that the current working directory is either

# under $POCO_BASE or under $PROJECT_BASE

# Also, if we're building under $POCO_BASE, disarm

# $PROJECT_BASE

7

#

cwd = $(shell pwd)

inpoco = $(shell echo | awk '{print index("$(cwd)","$(POCO_BASE)")}')

inproj = $(shell echo | awk '{print index("$(cwd)","$(PROJECT_BASE)")}')

ifeq ($(inpoco),1)

PROJECT_BASE = $(POCO_BASE)

else

ifeq ($(inproj),1)

else

$(error Current working directory not under $$PROJECT_BASE)

endif

endif

#

# Determine OS

#

POCO_HOST_OSNAME = $(shell uname)

ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN)

POCO_HOST_OSNAME = CYGWIN

endif

ifeq ($(findstring MINGW,$(POCO_HOST_OSNAME)),MINGW)

POCO_HOST_OSNAME = MinGW

endif

POCO_HOST_OSARCH = $(subst /,-,$(shell uname -m | tr ' ' _))

#

# Begin Sun platforms

#

# Pure Solaris or GNU (Nexenta), Sun Forte and Sun Studio compilers supported

# (on Nexenta, the default compiler is g++)

#

ifeq ($(findstring SunOS,$(POCO_HOST_OSNAME)),SunOS)

# detect if this is Nexenta platform

POCO_HOST_ALL_OSNAME := $(shell uname -a)

ifeq ($(findstring Nexenta,$(POCO_HOST_ALL_OSNAME)),Nexenta)

POCO_HOST_OSNAME := Nexenta

else # Up to version 5.5 SunOS-SunForte config is used, 5.6 and above use SunOS-SunStudio

POCO_COMPILER_NAME := $(shell CC -V 2>&1)

POCO_COMPILER_VERSION := $(subst .,,$(filter 5.%,$(POCO_COMPILER_NAME)))

ifeq (0, $(shell test $(POCO_COMPILER_VERSION) -gt 55; echo $$?))

POCO_CONFIG := SunOS-SunStudio

else

8

POCO_CONFIG := SunOS-SunForte

endif

endif

endif

#

# End Sun Platforms

#

#

# If POCO_CONFIG is not set, use the OS name as configuration name

#

ifndef POCO_CONFIG

POCO_CONFIG = $(POCO_HOST_OSNAME)

endif

#

# Check if a 64bit build is requested

#

ifndef OSARCH_64BITS

OSARCH_64BITS = 0

endif

ifeq ($(OSARCH_64BITS),1)

OSARCH_POSTFIX = 64

else

OSARCH_POSTFIX =

endif

#

# Include System Specific Settings

#

include $(POCO_BASE)/build/config/$(POCO_CONFIG)

#

# Determine operating system

#

ifndef POCO_TARGET_OSNAME

OSNAME := $(POCO_HOST_OSNAME)

else

OSNAME := $(POCO_TARGET_OSNAME)

endif

ifndef POCO_TARGET_OSARCH

OSARCH := $(subst /,-,$(shell uname -m | tr ' ' _))

else

9

OSARCH := $(POCO_TARGET_OSARCH)

endif

HOSTNAME := $(shell hostname)

#

# Find out current component

#

COMPONENT := $(shell $(POCO_BASE)/build/script/projname "$(PROJECT_BASE)")

#

# Define standard directories

#

SRCDIR = src

INCDIR = include

LIBDIR = lib/$(OSNAME)/$(OSARCH)

BINDIR = bin/$(OSNAME)/$(OSARCH)

OBJDIR = obj/$(OSNAME)/$(OSARCH)

DEPDIR = .dep/$(OSNAME)/$(OSARCH)

LIBPATH = $(POCO_BUILD)/$(LIBDIR)

BINPATH = $(POCO_BUILD)/$(COMPONENT)/$(BINDIR)

OBJPATH = $(POCO_BUILD)/$(COMPONENT)/$(OBJDIR)

DEPPATH = $(POCO_BUILD)/$(COMPONENT)/$(DEPDIR)

ifeq ($(POCO_BASE),$(PROJECT_BASE))

POCO_LIBRARY =

else

POCO_LIBRARY = -L$(POCO_BASE)/$(LIBDIR)

endif

ifndef LIBPREFIX

LIBPREFIX = lib

endif

#

# Build component list

#

COMPONENTS := $(shell cat $(POCO_BASE)/components)

#

# Read global library version number

#

LIBVERSION := $(shell cat $(POCO_BASE)/libversion)

#

10

# Determine link mode

#

ifndef LINKMODE

LINKMODE = BOTH

endif

ifeq ($(LINKMODE),SHARED)

DEFAULT_TARGET = all_shared

endif

ifeq ($(LINKMODE),STATIC)

DEFAULT_TARGET = all_static

endif

ifeq ($(LINKMODE),BOTH)

DEFAULT_TARGET = all_static all_shared

endif

#

# Compose compiler flags

#

COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)

CFLAGS += $(COMMONFLAGS) $(SYSFLAGS)

CXXFLAGS += $(COMMONFLAGS) $(SYSFLAGS)

LINKFLAGS += $(COMMONFLAGS) $(SYSFLAGS)

ifeq ($(OSARCH_64BITS),1)

CFLAGS += $(CFLAGS64)

CXXFLAGS += $(CXXFLAGS64)

SHLIBFLAGS += $(SHLIBFLAGS64)

DYLIBFLAGS += $(DYLIBFLAGS64)

LINKFLAGS += $(LINKFLAGS64)

else

CFLAGS += $(CFLAGS32)

CXXFLAGS += $(CXXFLAGS32)

SHLIBFLAGS += $(SHLIBFLAGS32)

DYLIBFLAGS += $(DYLIBFLAGS32)

LINKFLAGS += $(LINKFLAGS32)

endif

#

# Compose object file path

#

OBJPATH_RELEASE_STATIC = $(OBJPATH)/release_static$(OSARCH_POSTFIX)

OBJPATH_DEBUG_STATIC = $(OBJPATH)/debug_static$(OSARCH_POSTFIX)

OBJPATH_RELEASE_SHARED = $(OBJPATH)/release_shared$(OSARCH_POSTFIX)

11

OBJPATH_DEBUG_SHARED = $(OBJPATH)/debug_shared$(OSARCH_POSTFIX)

#

# Build Include directory List

#

INCLUDE = $(foreach p,$(POCO_ADD_INCLUDE),-I$(p)) -Iinclude $(foreach

p,$(COMPONENTS),-I$(POCO_BASE)/$(p)/$(INCDIR))

#

# Build Library Directory List

#

LIBRARY = $(foreach p,$(POCO_ADD_LIBRARY),-L$(p)) -L$(LIBPATH) $(POCO_LIBRARY)

#

# Strip Command definition

#

ifeq ($(strip $(STRIP)),)

STRIPCMD =

else

STRIPCMD = $(STRIP) $@$(BINEXT)

endif

#

# Remote debugging support

#

ifeq ($(strip $(STRIPDBG)),)

CPYDBG =

STRIPDBGCMD =

else

CPYDBG = cp $@ $@x

STRIPDBGCMD = $(STRIP) $@x

endif

#

# Make CC and CXX environment vars

#

export CC

export CXX

常见的修改:

POCO_BASE 定义poco代码目录

OSARCH_64BITS =1 定义64位编译模式

SRCDIR = src makefile与.cpp的位置

12

INCDIR = include .h文件夹

LIBDIR = lib lib文件夹

BINDIR = bin bin文件夹

OBJDIR = obj/$(OSNAME)/$(OSARCH)

DEPDIR = .dep/$(OSNAME)/$(OSARCH)

LIBPATH = $(POCO_BUILD)/$(LIBDIR)

BINPATH = $(POCO_BUILD)/$(COMPONENT)/$(BINDIR) -->建议改为 $(BINDIR)

OBJPATH = $(POCO_BUILD)/$(COMPONENT)/$(OBJDIR)-->可以不用管)$(OBJDIR)

DEPPATH = $(POCO_BUILD)/$(COMPONENT)/$(DEPDIR)-->依赖文件目录)$(DEPDIR)

系统自带的编译指令:

all: $(DEFAULT_TARGET)

all_static: static_debug static_release

all_shared: shared_debug shared_release

all_debug: static_debug shared_debug

all_release: static_release shared_release

自定义编译指令:

CFLAGS += -g

CXXFLAGS += -g

POCO_FLAGS +=

COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)

添加额外的头文件路径:

POCO_ADD_INCLUDE += $(ORACLE_HOME)/precomp/public $(ORACLE_HOME)/rdbms/public

$(ORACLE_HOME)/rdbms/demo

POCO_ADD_LIBRARY +=$(ORACLE_HOME)/$(OraLib)

添加额外的链接库非POCO编译出来的库

SYSLIBS +=-locci -lclntsh

编译方式:

gmake shared_release

gmake shared_debug

gmake static_release

gmake static_debug

gmake all_release

gmake all_debug

gmake all

13

tion库

4.2.1 core 模块

rm abstraction

1.统一了各个平台的数据类型比如 long ,int ,long long 等 ,参考types.h

2.平台的big-endian和little-endian 参考ByteOrder.h

3.平台类型相关信息platform.h

b. Memory Management

1.智能指针(smart pointer)和共享指针(shared pointer) 参考AutoPtr.h,SharedPtr.h

2.据以引用计数器的垃圾回收机制 AtomicCounter.h,refCountedObject.h

3.单件类(singleton objects) SingletonHolder.h

Utilities

字符串的比较(大小写转换,大小写无关转换,去除空白符号,字符转换和连接,分拆),

参考String.h,StringTokenizer.h

Handling

1. 断言类,类似assert,主要使用宏断言,比如poco_asert(myPtr);参考Bugcheck.h

2.异常类, 了解Poco::exception结构,使用POCO_DECLARE_EXCEPTION宏,参考Exception.h

14

s

pass

ing

pass

me

amp 微秒级精度,对gettimeofday()封装,参考Timestamp.h

tch 计时器,参考Stopwatch.h

me 日历时间,参考DateTime.h

d.日历时间的格式转换DateTimeFormat,DateTimeFormatter,DateTimeParser等

e.日历时区Timezone

f.本地时间LocalDateTime

4.2.5 FileSystem

与平台无关的文件,目录的操作类。

a. File类,读取文件的相关信息,比如权限,大小,日期,文件的删除,拷贝等

b. Path 类, 文件目录的解析,目录创建等

c. DirectoryIterator类,遍历指定目录下的文件列表

d. TemporaryFile 类,临时文件创建,删除等

4.2.6 Logging

可以输出到多个目的地(console,log files,Unix Syslog,Windows Event Log,remote logging)

主要是定义日志文件格式

# This is a sample configuration file.

=E:workspace

#定义日志层次结构

15

= ConsoleChannel

= global

=SplitterChannel

ls=c1,logfile

#日志p

=p

#l=file2

me=${}${}.log

#定义日志格式

= PatternFormatter

=local

n =

[%y/%m/%d %H:%M:%S][${}][%q]-%t

#定义日志输出地,输出地 名称 输出的格式

= ConsoleChannel

ter =formatter1

=FileChannel

=local

ter=formatter1

=${}/Download/${}_${}.log

#rotation

on=daily

#file2

=FileChannel

=local

#archive number|timestamp

e=number

=FileChannel

ter=formatter1

=${}_${}_

on=daily

ss=true

#purge purgeAge|purgeCount

16

ge=3 minutes

#ount=6

= debug

= SplitterChannel

///以channel开头的属性

l1 = consoleChannel

l2 = fileChannel

也可以配置成

ls=consoleChannel,fileChannel

///定义控制台通道

= ConsoleChannel

ter = f1

///定义文件通道

= FileChannel

=

= PatternFormattern"

n

= %Y-%m-%d %H:%M:%S,%i [%I] %p %s - %t

///定义消息格式

= PatternFormatter

n = %s-[%p] %t

17

= UTC

4.2.7 Processes

4.2.8 Shared Libraries

4.2.9 Notifications

4.2.10 Event

4.2.11 Crypt

4.2.12 Text

4.2.13 Regular Expressions

将下一个字符标记为一个特殊字符、或一个原义字符、或一个后向引用、或一个八进制转义符。

^ 匹配输入字符串的开始位置。如果设置了 RegExp 对象的Multiline 属性,^ 也匹配 ’n’ 或 ’r’ 之后的位置。

$ 匹配输入字符串的结束位置。如果设置了 RegExp 对象的Multiline 属性,$ 也匹配 ’n’ 或 ’r’ 之前的位置。

18

* 匹配前面的子表达式零次或多次。

+ 匹配前面的子表达式一次或多次。+ 等价于 {1,}。

? 匹配前面的子表达式零次或一次。? 等价于 {0,1}。

{n} n 是一个非负整数,匹配确定的n 次。

{n,} n 是一个非负整数,至少匹配n 次。

{n,m} m 和 n 均为非负整数,其中n <= m。最少匹配 n 次且最多匹配 m 次。在逗号和两个数之间不能有空格。

? 当该字符紧跟在任何一个其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面时,匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串,而默认的贪婪模式则尽可能多的匹配所搜索的字符串。

. 匹配除 "n" 之外的任何单个字符。要匹配包括 ’n’ 在内的任何字符,请使用象 ’[.n]’ 的模式.

(pattern) 匹配pattern 并获取这一匹配.

(?Ppattern)匹配pattern,匹配后goup可以用name代替数字(1) -> ('name').

(?:pattern) 匹配pattern 但不获取匹配结果,也就是说这是一个非获取匹配,不进行存储供以后使用。

(?=pattern) 正向预查,在任何匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。

(?!pattern) 负向预查,与(?=pattern)作用相反

x|y 匹配 x 或 y。

[xyz] 字符集合。

[^xyz] 负值字符集合。

[a-z] 字符范围,匹配指定范围内的任意字符。

[^a-z] 负值字符范围,匹配任何不在指定范围内的任意字符。

b 匹配一个单词边界,也就是指单词和空格间的位置。

B 匹配非单词边界。

cx 匹配由x指明的控制字符。

19

d 匹配一个数字字符。等价于 [0-9]。

D 匹配一个非数字字符。等价于 [^0-9]。

f 匹配一个换页符。等价于 x0c 和 cL。

n 匹配一个换行符。等价于 x0a 和 cJ。

r 匹配一个回车符。等价于 x0d 和 cM。

s 匹配任何空白字符,包括空格、制表符、换页符等等。等价于[ fnrtv]。

S 匹配任何非空白字符。等价于 [^ fnrtv]。

t 匹配一个制表符。等价于 x09 和 cI。

v 匹配一个垂直制表符。等价于 x0b 和 cK。

w 匹配包括下划线的任何单词字符。等价于’[A-Za-z0-9_]’。

W 匹配任何非单词字符。等价于 ’[^A-Za-z0-9_]’。

xn 匹配 n,其中 n 为十六进制转义值。十六进制转义值必须为确定的两个数字长。

num 匹配 num,其中num是一个正整数。对所获取的匹配的引用。

n 标识一个八进制转义值或一个后向引用。如果 n 之前至少 n 个获取的子表达式,则 n 为后向引用。否则,如果 n 为八进制数字 (0-7),则 n 为一个八进制转义值。

nm 标识一个八进制转义值或一个后向引用。如果 nm 之前至少有 is preceded by at least nm 个获取得子表达式,则 nm 为后向引用。如果 nm 之前至少有 n 个获取,则 n 为一 个后跟文字 m 的后向引用。如果前面的条件都不满足,若 n 和 m 均为八进制数字 (0-7),则 nm 将匹配八进制转义值 nm。

nml 如果 n 为八进制数字 (0-3),且 m 和 l 均为八进制数字 (0-7),则匹配八进制转义值 nml。

un 匹配 n,其中 n 是一个用四个十六进制数字表示的Unicode字符。

Xml解析器是对expat解析库的包装。

20

FTPClient HTML HTTP HTTPClient

HTTPServer ICMP Logging Mail

NetCore Reactor Sockets TCPServer

4.4.1 NetCore

为其它网络应用提供核心功能组件,比如 network address,DNS类

DNS类提供DNS解析功能

IPAddress类提供IP地址转换解析类

NetException类网络操作异常基础类

SocketAddress类由IP地址加端口号组成

4.4.2 Sockets

4.4.3 Reactor

4.4.4 HTTP

4.4.5 FTP

21

Net

4.4.6 Mail

4.4.7 HTML

主要是配置文件(ini,xml,properties)解析类,命令行参数解析类,以及构建命令行工具的框架类

4.5.1 Configuration files

提供了一个访问各类配置文件格式的接口,可以支持Java-style的property文件,windows风格的.ini文件以及XML文件

4.5.2 Command Line Options

处理与平台无关的命令行参数.例如在unix平台上参数都是以-或者—开头的,在windows平台参数选项以/开头。

ion(

Option("help", "h", "display help information on command line arguments")

.required(false)

.repeatable(false)

22

.callback(OptionCallback(this, &SampleApp::handleHelp)));

ion(

Option("define", "D", "define a configuration property")

.required(false)

.repeatable(true)

.argument("name=value")

.callback(OptionCallback(this, &SampleApp::handleDefine)));

ion(

Option("config-file", "f", "load configuration data from a file")

.required(false)

.repeatable(true)

.argument("file")

.callback(OptionCallback(this, &SampleApp::handleConfig))); --设置回调函数

ion(

Option("bind", "b", "bind option value to ty")

.required(false)

.repeatable(false)

.argument("value")

.binding("")); --- 相当于设置=value中的值,那么在其他的地方就可以引用

选项有如下属性:

full name : 长名字

short name 短名字

description:描述信息

optional|required 可选或者必选

repeatable:是否可以重复选择

1也选项可以成为一个选项组的一部分

选项可以绑定到配置属性中,这样配置属性就可以自动接受参数值

回调函数处理 当选择被指定 那么就处理该回调函数

选项验证信息

23

4.5.3 Tools and Server Applications

基于命令行工具和服务应用程序的框架。服务应用在Unix平台上实现为daemon,在windows平台上运行为服务

5.开发规范

24

发布评论

评论列表 (0)

  1. 暂无评论