CommonTWAIN.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. /***************************************************************************
  2. * Copyright © 2007 TWAIN Working Group:
  3. * Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company,
  4. * Fujitsu Computer Products of America, JFL Peripheral Solutions Inc.,
  5. * Ricoh Corporation, and Xerox Corporation.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions are met:
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * * Neither the name of the TWAIN Working Group nor the
  16. * names of its contributors may be used to endorse or promote products
  17. * derived from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY
  20. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY
  23. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. ***************************************************************************/
  31. /**
  32. * @file CommonTWAIN.h
  33. * Common defines and typedefs used by the DS
  34. * @author TWAIN Working Group
  35. * @date April 2007
  36. */
  37. #ifndef __COMMONTWAIN_H__
  38. #define __COMMONTWAIN_H__
  39. #include "Common.h"
  40. #include <string>
  41. using namespace std;
  42. typedef struct _TW_GUID {
  43. unsigned long Data1;
  44. unsigned short Data2;
  45. unsigned short Data3;
  46. unsigned char Data4[ 8 ];
  47. } TW_GUID;
  48. /**
  49. * @def kTWAIN_DSM_DLL_NAME
  50. * File name of the DSM library.
  51. */
  52. #ifdef TWH_CMP_MSC
  53. #ifdef TWH_64BIT
  54. #define kTWAIN_DSM_DLL_NAME "TWAINDSM.dll"
  55. #else
  56. #define kTWAIN_DSM_DLL_NAME "TWAINDSM.dll"
  57. #endif // #ifdef TWH_64BIT
  58. #elif defined(TWH_CMP_GNU)
  59. #define kTWAIN_DSM_DLL_NAME "libtwaindsm.so"
  60. #else
  61. #error Sorry, we don't recognize this system...
  62. #endif
  63. /**
  64. * A commonly used conversion function for converting float to TW_FIX32.
  65. * @param[in] floater the float value to change to TW_FIX32
  66. * @return the value as TW_FIX32
  67. */
  68. TW_FIX32 FloatToFIX32 (float floater);
  69. /**
  70. * A commonly used conversion function for converting TW_FIX32 to float.
  71. * @param[in] _fix32 the TW_FIX32 value to change to float
  72. * @return the value as float
  73. */
  74. float FIX32ToFloat(const TW_FIX32& _fix32);
  75. /* Set the packing: this occurs before any structures are defined */
  76. #ifdef TWH_CMP_MSC
  77. #pragma pack (push, before_twain)
  78. #pragma pack (2)
  79. #elif defined(TWH_CMP_GNU)
  80. #pragma pack (push, before_twain)
  81. #ifdef __APPLE__
  82. //#pragma pack (4)
  83. #else
  84. #pragma pack (2)
  85. #endif
  86. #elif defined(TWH_CMP_BORLAND)
  87. #pragma option -a2
  88. #endif
  89. // The following structures combinations are implimented and found in the TWAIN specifications
  90. // BOOL INT8 INT16 INT32 UINT8 UINT16 UINT32 STR32 STR64 STR128 STR255 STR1024 UNI512 FIX32 FRAME
  91. // OneValue x x x x x x x x x x
  92. // Array x x x x x x
  93. // Enumeration x x x x x x x x
  94. // Range x x x x x
  95. /**
  96. * TW_ONEVALUE that holds a TW_FIX32 item
  97. */
  98. typedef struct {
  99. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FIX32 */
  100. #ifdef __APPLE__
  101. TW_UINT16 Dummy;
  102. #endif
  103. TW_FIX32 Item; /**< TW_FIX32 value being passed */
  104. } TW_ONEVALUE_FIX32, FAR * pTW_ONEVALUE_FIX32; /**< Pointer to TW_ONEVALUE that holds a TW_FIX32 item */
  105. /**
  106. * TW_ONEVALUE that holds a TW_STR32 item
  107. */
  108. typedef struct {
  109. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR32 */
  110. TW_STR32 Item; /**< TW_STR32 value being passed */
  111. } TW_ONEVALUE_STR32, FAR * pTW_ONEVALUE_STR32; /**< Pointer to TW_ONEVALUE that holds a TW_STR32 item */
  112. /**
  113. * TW_ONEVALUE that holds a TW_STR64 item
  114. */
  115. typedef struct {
  116. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR64 */
  117. TW_STR64 Item; /**< TW_STR32 value being passed */
  118. } TW_ONEVALUE_STR64, FAR * pTW_ONEVALUE_STR64; /**< Pointer to TW_ONEVALUE that holds a TW_STR32 item */
  119. /**
  120. * TW_ONEVALUE that holds a TW_STR128 item
  121. */
  122. typedef struct {
  123. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR128 */
  124. TW_STR128 Item; /**< TW_STR128 value being passed */
  125. } TW_ONEVALUE_STR128, FAR * pTW_ONEVALUE_STR128; /**< Pointer to TW_ONEVALUE that holds a TW_STR128 item */
  126. /**
  127. * TW_ONEVALUE that holds a TW_STR255 item
  128. */
  129. typedef struct {
  130. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR255 */
  131. TW_STR255 Item; /**< TW_STR255 value being passed */
  132. } TW_ONEVALUE_STR255, FAR * pTW_ONEVALUE_STR255; /**< Pointer to TW_ONEVALUE that holds a TW_STR255 item */
  133. /**
  134. * TW_ONEVALUE that holds a TW_FRAME item
  135. */
  136. typedef struct {
  137. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FRAME */
  138. #ifdef __APPLE__
  139. TW_UINT16 Dummy;
  140. #endif
  141. TW_FRAME Item; /**< TW_FRAME structure being passed */
  142. } TW_ONEVALUE_FRAME, FAR * pTW_ONEVALUE_FRAME; /**< Pointer to TW_ONEVALUE that holds a TW_FRAME item */
  143. /**
  144. * TW_ARRAY that holds a TW_UINT8 item
  145. */
  146. typedef struct {
  147. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT8 */
  148. TW_UINT32 NumItems; /**< How many items in ItemList */
  149. TW_UINT8 ItemList[1]; /**< Array of TW_UINT8 structures starts here */
  150. } TW_ARRAY_UINT8, FAR * pTW_ARRAY_UINT8; /**< Pointer to TW_ARRAY that holds a TW_UINT8 item */
  151. /**
  152. * TW_ARRAY that holds a TW_UINT16 item
  153. */
  154. typedef struct {
  155. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT16 */
  156. TW_UINT32 NumItems; /**< How many items in ItemList */
  157. TW_UINT16 ItemList[1]; /**< Array of TW_UINT16 structures starts here */
  158. } TW_ARRAY_UINT16, FAR * pTW_ARRAY_UINT16; /**< Pointer to TW_ARRAY that holds a TW_UINT16 item */
  159. /**
  160. * TW_ARRAY that holds a TW_UINT32 item
  161. */
  162. typedef struct {
  163. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT32 */
  164. TW_UINT32 NumItems; /**< How many items in ItemList */
  165. TW_UINT32 ItemList[1]; /**< Array of TW_UINT32 structures starts here */
  166. } TW_ARRAY_UINT32, FAR * pTW_ARRAY_UINT32; /**< Pointer to TW_ARRAY that holds a TW_UINT32 item */
  167. /**
  168. * TW_ARRAY that holds a TW_STR32 item
  169. */
  170. typedef struct {
  171. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR32 */
  172. TW_UINT32 NumItems; /**< How many items in ItemList */
  173. TW_STR32 ItemList[1]; /**< Array of TW_STR32 structures starts here */
  174. } TW_ARRAY_STR32, FAR * pTW_ARRAY_STR32; /**< Pointer to TW_ARRAY that holds a TW_STR32 item */
  175. /**
  176. * TW_ARRAY that holds a TW_FIX32 item
  177. */
  178. typedef struct {
  179. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FIX32 */
  180. TW_UINT32 NumItems; /**< How many items in ItemList */
  181. TW_FIX32 ItemList[1]; /**< Array of TW_FIX32 structures starts here */
  182. } TW_ARRAY_FIX32, FAR * pTW_ARRAY_FIX32; /**< Pointer to TW_ARRAY that holds a TW_FIX32 item */
  183. /**
  184. * TW_ARRAY that holds a TW_FRAME item
  185. */
  186. typedef struct {
  187. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FRAME */
  188. TW_UINT32 NumItems; /**< How many items in ItemList */
  189. TW_FRAME ItemList[1]; /**< Array of TW_FRAME structures starts here */
  190. } TW_ARRAY_FRAME, FAR * pTW_ARRAY_FRAME; /**< Pointer to TW_ARRAY that holds a TW_FRAME item */
  191. /**
  192. * TW_ENUMERATION that holds a TW_BOOL item
  193. */
  194. typedef struct {
  195. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_BOOL */
  196. TW_UINT32 NumItems; /**< How many items in ItemList */
  197. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  198. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  199. TW_BOOL ItemList[1]; /**< Array of ItemType values starts here */
  200. } TW_ENUMERATION_BOOL, FAR * pTW_ENUMERATION_BOOL; /**< Pointer to TW_ENUMERATION that holds an array TW_BOOL items */
  201. /**
  202. * TW_ENUMERATION that holds a TW_INT16 item
  203. */
  204. typedef struct {
  205. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_INT16 */
  206. TW_UINT32 NumItems; /**< How many items in ItemList */
  207. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  208. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  209. TW_INT16 ItemList[1]; /**< Array of ItemType values starts here */
  210. } TW_ENUMERATION_INT16, FAR * pTW_ENUMERATION_INT16;/**< Pointer to TW_ENUMERATION that holds an array TW_INT16 items */
  211. /**
  212. * TW_ENUMERATION that holds a TW_INT32 item
  213. */
  214. typedef struct {
  215. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_INT32 */
  216. TW_UINT32 NumItems; /**< How many items in ItemList */
  217. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  218. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  219. TW_INT32 ItemList[1]; /**< Array of ItemType values starts here */
  220. } TW_ENUMERATION_INT32, FAR * pTW_ENUMERATION_INT32;/**< Pointer to TW_ENUMERATION that holds an array TW_UINT32 items */
  221. /**
  222. * TW_ENUMERATION that holds a TW_UINT16 item
  223. */
  224. typedef struct {
  225. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT16 */
  226. TW_UINT32 NumItems; /**< How many items in ItemList */
  227. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  228. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  229. TW_UINT16 ItemList[1]; /**< Array of ItemType values starts here */
  230. } TW_ENUMERATION_UINT16, FAR * pTW_ENUMERATION_UINT16;/**< Pointer to TW_ENUMERATION that holds an array TW_UINT16 items */
  231. /**
  232. * TW_ENUMERATION that holds a TW_UINT32 item
  233. */
  234. typedef struct {
  235. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_UINT32 */
  236. TW_UINT32 NumItems; /**< How many items in ItemList */
  237. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  238. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  239. TW_UINT32 ItemList[1]; /**< Array of ItemType values starts here */
  240. } TW_ENUMERATION_UINT32, FAR * pTW_ENUMERATION_UINT32;/**< Pointer to TW_ENUMERATION that holds an array TW_UINT32 items */
  241. /**
  242. * TW_ENUMERATION that holds a TW_STR32 item
  243. */
  244. typedef struct {
  245. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR32 */
  246. TW_UINT32 NumItems; /**< How many items in ItemList */
  247. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  248. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  249. TW_STR32 ItemList[1]; /**< Array of ItemType values starts here */
  250. } TW_ENUMERATION_STR32, FAR * pTW_ENUMERATION_STR32;/**< Pointer to TW_ENUMERATION that holds an array TW_STR32 items */
  251. /**
  252. * TW_ENUMERATION that holds a TW_STR64 item
  253. */
  254. typedef struct {
  255. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR64 */
  256. TW_UINT32 NumItems; /**< How many items in ItemList */
  257. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  258. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  259. TW_STR64 ItemList[1]; /**< Array of ItemType values starts here */
  260. } TW_ENUMERATION_STR64, FAR * pTW_ENUMERATION_STR64;/**< Pointer to TW_ENUMERATION that holds an array TW_STR32 items */
  261. /**
  262. * TW_ENUMERATION that holds a TW_STR128 item
  263. */
  264. typedef struct {
  265. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR128 */
  266. TW_UINT32 NumItems; /**< How many items in ItemList */
  267. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  268. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  269. TW_STR128 ItemList[1]; /**< Array of ItemType values starts here */
  270. } TW_ENUMERATION_STR128, FAR * pTW_ENUMERATION_STR128;/**< Pointer to TW_ENUMERATION that holds an array TW_STR32 items */
  271. /**
  272. * TW_ENUMERATION that holds a TW_STR255 item
  273. */
  274. typedef struct {
  275. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_STR255 */
  276. TW_UINT32 NumItems; /**< How many items in ItemList */
  277. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  278. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  279. TW_STR255 ItemList[1]; /**< Array of ItemType values starts here */
  280. } TW_ENUMERATION_STR255, FAR * pTW_ENUMERATION_STR255;/**< Pointer to TW_ENUMERATION that holds an array TW_STR255 items */
  281. /**
  282. * TW_ENUMERATION that holds a TW_FIX32 item
  283. */
  284. typedef struct {
  285. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FIX32 */
  286. TW_UINT32 NumItems; /**< How many items in ItemList */
  287. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  288. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  289. TW_FIX32 ItemList[1]; /**< Array of ItemType values starts here */
  290. } TW_ENUMERATION_FIX32, FAR * pTW_ENUMERATION_FIX32;/**< Pointer to TW_ENUMERATION that holds an array TW_FIX32 items */
  291. /**
  292. * TW_ENUMERATION that holds a TW_FRAME item
  293. */
  294. typedef struct {
  295. TW_UINT16 ItemType; /**< Assigned TWAIN Type TWTY_FRAME */
  296. TW_UINT32 NumItems; /**< How many items in ItemList */
  297. TW_UINT32 CurrentIndex; /**< Current value is in ItemList[CurrentIndex] */
  298. TW_UINT32 DefaultIndex; /**< Powerup value is in ItemList[DefaultIndex] */
  299. TW_FRAME ItemList[1]; /**< Array of TW_FRAME structures starts here */
  300. } TW_ENUMERATION_FRAME, FAR * pTW_ENUMERATION_FRAME;/**< Pointer to TW_ENUMERATION that holds a TW_FRAME item */
  301. /**
  302. * TW_RANGE that holds a TW_FIX32 item
  303. */
  304. typedef struct {
  305. TW_UINT16 ItemType;
  306. #ifdef __APPLE__
  307. TW_UINT16 Dummy;
  308. #endif
  309. TW_FIX32 MinValue; /* Starting value in the range. */
  310. TW_FIX32 MaxValue; /* Final value in the range. */
  311. TW_FIX32 StepSize; /* Increment from MinValue to MaxValue. */
  312. TW_FIX32 DefaultValue; /* Power-up value. */
  313. TW_FIX32 CurrentValue; /* The value that is currently in effect. */
  314. } TW_RANGE_FIX32, FAR * pTW_RANGE_FIX32; /**< Pointer to TW_RANGE that holds an array TW_FIX32 items */
  315. /* Restore the previous packing alignment: this occurs after all structures are defined */
  316. #ifdef TWH_CMP_MSC
  317. #pragma pack (pop, before_twain)
  318. #elif defined(TWH_CMP_GNU)
  319. #pragma pack (pop, before_twain)
  320. #elif defined(TWH_CMP_BORLAND)
  321. #pragma option ña.
  322. //#elif defined(TWH_CMP_XCODE)
  323. // #if PRAGMA_STRUCT_ALIGN
  324. // #pragma options align=reset
  325. // #elif PRAGMA_STRUCT_PACKPUSH
  326. // #pragma pack (pop)
  327. // #elif PRAGMA_STRUCT_PACK
  328. // #pragma pack()
  329. // #endif
  330. #endif
  331. #ifdef TWH_CMP_GNU
  332. #pragma pack(1)
  333. /**
  334. * Structure contains information about the type, size, and layout of a file
  335. * that contains a DIB.
  336. */
  337. typedef struct tagBITMAPFILEHEADER
  338. {
  339. WORD bfType; /**< Specifies the file type, must be BM. */
  340. DWORD bfSize; /**< Specifies the size, in bytes, of the bitmap file. */
  341. WORD bfReserved1; /**< Reserved; must be zero. */
  342. WORD bfReserved2; /**< Reserved; must be zero. */
  343. DWORD bfOffBits; /**< Specifies the offset, in bytes, from the beginning of
  344. the BITMAPFILEHEADER structure to the bitmap bits. */
  345. } BITMAPFILEHEADER;
  346. #pragma pack() // reset
  347. #endif // TWH_CMP_GNU
  348. /**
  349. * Get the current value from a Capability as a TW_UINT32.
  350. * @param[in] pCap a pointer to the capability to retrieve the current value
  351. * @param[out] val the value retrieved from the capability
  352. * @return true if successful
  353. */
  354. bool getCurrent(TW_CAPABILITY *pCap, TW_UINT32& val);
  355. /**
  356. * Get the current value from a Capability as a string for capabilities of
  357. * types TWTY_STR32, TWTY_STR64, TWTY_STR128, and TWTY_STR256
  358. * @param[in] pCap a pointer to the capability to retrieve the current value
  359. * @param[out] val the value retrieved from the capability
  360. * @return true if successful
  361. */
  362. bool getCurrent(TW_CAPABILITY *pCap, string& val);
  363. /**
  364. * Get the current value from a Capability as a TW_FIX32.
  365. * @param[in] pCap a pointer to the capability to retrieve the current value
  366. * @param[out] val the value retrieved from the capability
  367. * @return true if successful
  368. */
  369. bool getCurrent(TW_CAPABILITY *pCap, TW_FIX32& val);
  370. /**
  371. * Get the current value from a Capability as a TW_FRAME.
  372. * @param[in] pCap a pointer to the capability to retrieve the current value
  373. * @param[out] val the value retrieved from the capability
  374. * @return true if successful
  375. */
  376. bool getCurrent(TW_CAPABILITY *pCap, TW_FRAME& val);
  377. /**
  378. * Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY
  379. * type Capability as a TW_UINT32.
  380. * @param[in] pCap a pointer to the capability to retrieve the value
  381. * @pCount[in] item the 0 based location in the array to retrieve the item.
  382. * @param[out] val the value retrieved from the capability
  383. * @return true if successful. false if no value returned
  384. */
  385. bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_UINT32& val);
  386. /**
  387. * Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY
  388. * containing types TWTY_STR32, TWTY_STR64, TWTY_STR128, and TWTY_STR256
  389. * @param[in] pCap a pointer to the capability to retrieve the value
  390. * @pCount[in] item the 0 based location in the array to retrieve the item.
  391. * @param[out] val the value retrieved from the capability
  392. * @return true if successful. false if no value returned
  393. */
  394. bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, string& val);
  395. /**
  396. * Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY
  397. * containing type TWTY_FIX32
  398. * @param[in] pCap a pointer to the capability to retrieve the value
  399. * @pCount[in] item the 0 based location in the array to retrieve the item.
  400. * @param[out] val the value retrieved from the capability
  401. * @return true if successful. false if no value returned
  402. */
  403. bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_FIX32& val);
  404. /**
  405. * Get an item value from an array of values from a TW_ENUMERATION or TW_ARRAY
  406. * containing type TWTY_FRAME
  407. * @param[in] pCap a pointer to the capability to retrieve the value
  408. * @pCount[in] item the 0 based location in the array to retrieve the item.
  409. * @param[out] val the value retrieved from the capability
  410. * @return true if successful. false if no value returned
  411. */
  412. bool GetItem(TW_CAPABILITY *pCap, TW_UINT32 item, TW_FRAME& val);
  413. /**
  414. * Get the size of TWAIN type
  415. * @param[in] ItemType the TWAIN type to return the size for
  416. * @return the size of the type returned
  417. */
  418. int getTWTYsize(TW_UINT16 ItemType);
  419. #endif // __COMMONTWAIN_H__