Go to the documentation of this file.
28 for (ii=0; ii < cnt; ++ii) {
29 if (0 == strcmp(
pwpRtItem[ii].apiInfo.name, api)) {
57 return (pApiInfo? pApiInfo->
msgCB : 0);
80 ret = msgCB(api,
id, pMsg);
103 msg.
text = (txt ? txt :
"");
179 if ((0 != total) && (complete < total)) {
220 union endian_test_t {
224 const etest = { 0xAABBCCDD };
232 # define ENDIAN_MAXSIZE 32
238 else if (1 == size) {
243 switch (endianness) {
246 if (osEndianness == endianness) {
256 const char *cbuf = (
const char *)buf;
258 size_t tNdx = size-1;
259 while (hNdx < tNdx) {
260 tmpBuf[hNdx] = cbuf[tNdx];
261 tmpBuf[tNdx--] = cbuf[hNdx++];
279 # undef ENDIAN_MAXSIZE
289 #define STAT_MASK ((PWP_UINT32)(0xFFFFFFF0))
290 #define STAT_BASE ((PWP_UINT32)(0x9ABCDEF0))
291 #define STAT_OPEN ((PWP_UINT32)(STAT_BASE | 0x1))
292 #define STAT_CLOSED ((PWP_UINT32)(STAT_BASE | 0x0))
294 #define UDATA_ISINIT(pUD) (STAT_BASE == (STAT_MASK & (pUD)->status))
295 #define UDATA_ISOPEN(pUD) ((pUD) && (STAT_OPEN == (pUD)->status) && (pUD)->fp && !(pUD)->hadError)
296 #define UDATA_INREC(pUD) (UDATA_ISOPEN(pUD) && (pUD)->inRec)
297 #define UDATA_ISCLOSED(pUD) ((pUD) && (STAT_CLOSED == (pUD)->status))
482 if (itemCnt ==
pwpFileWrite(arr, itemSize, itemCnt, pUData->
fp)) {
647 const char *ret =
"Unknown";
655 case PWP_VALTYPE_SIZE:
break;
677 NameStrMap::iterator it =
data_.find(name);
678 if (
data_.end() != it) {
684 data_.insert(NameStrMap::value_type(name, value));
691 NameStrMap::const_iterator it =
data_.find(name);
692 if (
data_.end() != it) {
709 NameStrMap::iterator it =
data_.find(name);
710 if (
data_.end() != it) {
736 else if (j2.empty()) {
740 bool j1EndsWithDot = (sepChar == j1[j1.size() - 1]);
741 bool j2StartsWithDot = (sepChar == j2[0]);
743 if (j1EndsWithDot && j2StartsWithDot) {
745 res.append(j2.begin() + 1, j2.end());
747 else if (j1EndsWithDot) {
750 else if (j2StartsWithDot) {
754 res.append(1, sepChar);
857 const char value[],
bool createIfNotExists)
860 if (group && group[0] && name && name[0]) {
876 PWP_INT value,
bool createIfNotExists)
878 std::ostringstream buf;
879 buf << value << std::ends;
880 return PwuAssignValue(group, name, buf.str().c_str(), createIfNotExists);
885 PWP_UINT value,
bool createIfNotExists)
887 std::ostringstream buf;
888 buf << value << std::ends;
889 return PwuAssignValue(group, name, buf.str().c_str(), createIfNotExists);
894 PWP_REAL value,
bool createIfNotExists)
896 std::ostringstream buf;
897 buf << value << std::ends;
898 return PwuAssignValue(group, name, buf.str().c_str(), createIfNotExists);
903 const char value[],
bool createIfNotExists)
911 const char desc[],
const char range[])
923 if (group && group[0] && name && name[0]) {
931 varNames =
PwuJoin(varNames, name,
'|');
953 PwuGetValue(
const char group[],
const char name[], PWP_HVALUE hVal)
965 template<
typename T, PWP_ENUM_VALTYPE TId>
981 return PwuValueSetter<const char, PWP_VALTYPE_STRING>(hVal, val);
988 return PwuValueSetter<PWP_INT, PWP_VALTYPE_INT>(hVal, &val);
995 return PwuValueSetter<PWP_UINT, PWP_VALTYPE_UINT>(hVal, &val);
1002 return PwuValueSetter<PWP_REAL, PWP_VALTYPE_REAL>(hVal, &val);
1009 return PwuValueSetter<const char, PWP_VALTYPE_ENUM>(hVal, val);
1016 return PwuValueSetter<PWP_BOOL, PWP_VALTYPE_BOOL>(hVal, &val);
static PwuString PwuValueDefnTypeKey(const PwuString &rootGroup, const PwuString &valName)
static PwuString PwuValueDefnAttrGroup(const PwuString &rootGroup, const PwuString &valName)
@ PWP_VALTYPE_STRING
transfer value is a const char*
static PwuString PwuValueDefnDefaultKey(const PwuString &rootGroup, const PwuString &valName)
PWU_RTITEM pwpRtItem[]
The runtime array of PWU_RTITEM items.
@ PWP_MSGID_PROGQUIT
Query progress quit message id (see PWP_MSG_PROGRESS)
static PwuString PwuValueDefnRangeKey(const PwuString &rootGroup, const PwuString &valName)
static PwuString PwuValueDefnDescKey(const PwuString &rootGroup, const PwuString &valName)
PWP_UINT32 totalApiCnt
The total # of published and unpublished entries in pwpRtItem[].
PWU_RTITEM * PwuFindTotalAPI(const char api[])
Find any api in pwpRtItem[].
#define PWU_VALUE_DEFN_DEFAULT_STR
PwuString & operator[](const PwuString &name)
static PWP_BOOL PwuValueSetter(PWP_HVALUE hVal, T *val)
PWP_BOOL PwuValueSetEnum(PWP_HVALUE hVal, const char *val)
PWP_BOOL inRec
"in record" flag
void PwuProgressEnd(const char api[], PWP_BOOL ok)
Send a progress end message (PWP_MSGID_PROGEND) to the framework.
PWP_ENUM_VALTYPE
Supported PWP-API getValue() transfer types.
#define PWU_VALUE_DEFN_ACCESS_STR
@ PWP_MSGID_PROGEND
End progress message id (see PWP_MSG_PROGRESS)
PWP_UINT32 value
The progress value.
The runtime data representing a PWP-API suported by a plugin.
#define PWP_MESSAGECB_DEFAULT
Special API name used to register the default message handler.
static void PwuSendTextMsg(const char api[], PWP_ENUM_MSGID id, const char txt[], PWP_UINT32 code)
PWP_BOOL PwuAssignValue(const char group[], const char name[], const char value[], bool createIfNotExists)
Assign or create a value.
PWP_BOOL PwuAssignValueInt(const char group[], const char name[], PWP_INT value, bool createIfNotExists)
@ PWP_MSGID_WARNING
Non-fatal error text message id (see PWP_MSG_TEXT)
PWP_BOOL PwuProgressStatus(const char api[], PWP_UINT32 complete, PWP_UINT32 total)
Send a progress status message (PWP_MSGID_PROGSTATUS, value >= 0) to the framework.
PWP_BOOL PwuPublishValueDefinition(const char group[], const char name[], PWP_ENUM_VALTYPE type, const char value[], const char access[], const char desc[], const char range[])
Create a value.
PWP_BOOL PwuProgressNextStep(const char api[])
Send a progress "next step" message (PWP_MSGID_PROGSTATUS, value = -1) to the framework.
@ PWP_MSGID_PROGSTATUS
Status progress message id (see PWP_MSG_PROGRESS)
PWP_ENDIANNESS PwuGetOsEndianness(void)
Query the OS's native endianness.
PWP_MESSAGECB PwuFindApiMsgCB(const char api[])
Search pwpRtItem[] for an API's messageCB.
static PWU_RTITEM * PwuFindAPI(const char api[], PWP_UINT32 cnt)
static PwuString PwuValueDefnsGroup(const PwuString &rootGroup)
PWP_UINT32 publishedApiCnt
The total # of published entries in pwpRtItem[].
The data sent by plugins for text messages.
void PwuSendWarningMsg(const char api[], const char txt[], PWP_UINT32 code)
Send a warning text message (PWP_MSGID_WARNING) to the framework.
PWP_BOOL PwuValueSetReal(PWP_HVALUE hVal, PWP_REAL val)
PwuString PwuJoin(const PwuString &j1, const PwuString &j2, char sepChar='.')
void PwuSendInfoMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an info text message (PWP_MSGID_INFO) to the framework.
PWP_BOOL PwuValueSetBool(PWP_HVALUE hVal, PWP_BOOL val)
static PWP_BOOL unfUDataInit(PWU_UNFDATA *pUData)
PWP_ENDIANNESS endianness
write data using this endianness
static PwuString PwuValueDefnAccessKey(const PwuString &rootGroup, const PwuString &valName)
PWP_BOOL PwuGetValue(const char group[], const char name[], PWP_HVALUE hVal)
Implementation of the PwpGetValue() API function.
@ PWP_VALTYPE_REAL
transfer value is a PWP_REAL
PWU_RTITEM * PwuFindPublishedAPI(const char api[])
Find a published api in pwpRtItem[].
PWP_UINT32 status
current file status
PWP_UINT32 PwuSendMsg(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Send a message from an api.
static const char * typeToString(PWP_ENUM_VALTYPE type)
void PwuSendErrorMsg(const char api[], const char txt[], PWP_UINT32 code)
Send an error text message (PWP_MSGID_ERROR) to the framework.
PWP_UINT32 fixedBytes
user provided # record bytes
PWP_BOOL PwuAssignValueUInt(const char group[], const char name[], PWP_UINT value, bool createIfNotExists)
void * dest_
Pointer to the opaque value destination.
PWP_ENUM_MSGID
Supported PWP-API message ids.
static PWP_UINT32 PwuSendProgressMsg(const char api[], PWP_ENUM_MSGID id, PWP_UINT32 value)
@ PWP_MSGID_INFO
Information text message id (see PWP_MSG_TEXT)
@ PWP_MSGID_DEBUG
Debug text message id (see PWP_MSG_TEXT)
PWP_BOOL PwuValueSetString(PWP_HVALUE hVal, const char *val)
Set the value of a variable handle.
std::map< PwuString, PwuString > NameStrMap
PWP_ENDIANNESS
Flags used to indicate endianness or control endian behaviors in functions.
const char * text
API defined message string.
@ PWP_VALTYPE_BOOL
transfer value is a PWP_BOOL
PWP_MESSAGECB msgCB
The API's assigned message callback.
PWP_UINT32 totRecBytes
total # bytes written to all records
@ PWP_VALTYPE_INT
transfer value is a PWP_INT
PWP_BOOL PwuProgressQuit(const char api[])
Send a progress query-quit message (PWP_MSGID_PROGQUIT) to the framework.
#define PWU_PUBLISH_DEFNS_STR
PwpValue_t * PwpValueCB_
Callback function used to marshall a plugin value into dest_.
void erase(const PwuString &name)
#define PWU_VALUE_DEFN_RANGE_STR
std::pair< NameStrMap::iterator, bool > NameStrMapInsertRet
@ PWP_MSGID_PROGBEGIN
Begin progress message id (see PWP_MSG_PROGRESS)
PWP_BOOL PwuAssignValueReal(const char group[], const char name[], PWP_REAL value, bool createIfNotExists)
#define PWU_PUBLISH_NAMES_STR
void PwuSendDebugMsg(const char api[], const char txt[], PWP_UINT32 code)
Send a debug text message (PWP_MSGID_DEBUG) to the framework.
PWP_BOOL hadError
error flag
PWP_UINT32(* PWP_MESSAGECB)(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Message handler callback function signature.
const void * PwuApplyEndianness(PWP_ENDIANNESS endianness, const void *buf, size_t size)
Apply specified byte order to buf containing size bytes.
@ PWP_VALTYPE_ENUM
transfer value is a const char*
PwuString & get(const PwuString &name, PwuString &value, const PwuString &defVal, bool &isDefVal)
Data and functions useful to PWP-API compliant plugins.
Pointwise Plugin API (PWP-API)
#define PWU_VALUE_DEFN_NAME_STR
PWP_UINT32 code
API defined message code.
@ PWP_MSGID_ERROR
Fatal error text message id (see PWP_MSG_TEXT)
#define UDATA_ISOPEN(pUD)
void set(const PwuString &name, const PwuString &value)
static PwuString PwuValueDefnNameKey(const PwuString &rootGroup, const PwuString &valName)
static NamedStrings namedStrings
@ PWP_VALTYPE_UINT
transfer value is a PWP_UINT
bool exists(const PwuString &name)
PWP_BOOL PwuAssignValueEnum(const char group[], const char name[], const char value[], bool createIfNotExists)
sysFILEPOS fPos
file position value
static PwuString PwuValueNamesGroup(const PwuString &rootGroup)
static PWP_BOOL unfHdrLenWrite(PWU_UNFDATA *pUData)
The data sent by plugins for progress messages.
PWP_BOOL PwuValueSetInt(PWP_HVALUE hVal, PWP_INT val)
#define PWU_VALUE_DEFN_DESC_STR
#define PWU_VALUE_DEFN_TYPE_STR
PWP_BOOL PwuProgressBegin(const char api[], PWP_UINT32 totalSteps)
Send a progress begin message (PWP_MSGID_PROGBEGIN) to the framework.
PWP_BOOL PwuValueSetUInt(PWP_HVALUE hVal, PWP_UINT val)
#define PWP_MESSAGECB_SPY
Special API name used to register the spy message handler.
Unformatted file data block.
#define PWP_HVALUE_GET_IMPL(h)
obtains the underlying PWP_HVALUE_IMPL ptr from the handle
#define UDATA_ISINIT(pUD)