diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-02-03 13:11:04 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-02-03 13:11:04 -0500 |
commit | f65028e38eda00cd2329bb1ab7db0261ae6452f2 (patch) | |
tree | 1b7601a5577dd8c439c67d615b1f987c59ceb481 /indra/test/manageapr.h | |
parent | 90ba675da4416a7f75f59340633e2c007b6cc029 (diff) | |
parent | 491cd825561be1cf4a6f428a535811cbe0e3f179 (diff) |
Automated merge with file:///Users/nat/linden/viewer-tut-fix
Diffstat (limited to 'indra/test/manageapr.h')
-rw-r--r-- | indra/test/manageapr.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/indra/test/manageapr.h b/indra/test/manageapr.h new file mode 100644 index 0000000000..0c1ca7b7be --- /dev/null +++ b/indra/test/manageapr.h @@ -0,0 +1,45 @@ +/** + * @file manageapr.h + * @author Nat Goodspeed + * @date 2012-01-13 + * @brief ManageAPR class for simple test programs + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Copyright (c) 2012, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_MANAGEAPR_H) +#define LL_MANAGEAPR_H + +#include "llapr.h" + +/** + * Declare a static instance of this class for dead-simple ll_init_apr() at + * program startup, ll_cleanup_apr() at termination. This is recommended for + * use only with simple test programs. Once you start introducing static + * instances of other classes that depend on APR already being initialized, + * the indeterminate static-constructor-order problem rears its ugly head. + */ +class ManageAPR +{ +public: + ManageAPR() + { + ll_init_apr(); + } + + ~ManageAPR() + { + ll_cleanup_apr(); + } + + static std::string strerror(apr_status_t rv) + { + char errbuf[256]; + apr_strerror(rv, errbuf, sizeof(errbuf)); + return errbuf; + } +}; + +#endif /* ! defined(LL_MANAGEAPR_H) */ |