aseclass.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. // Name: aseclass.h
  11. //
  12. // Description:
  13. // This file describes the ASE Program Interface
  14. // classes for C++ AutoCAD applications.
  15. #ifndef _ASECLASS_H
  16. #define _ASECLASS_H
  17. /***************************************************************************/
  18. /* INCLUDES */
  19. /***************************************************************************/
  20. #include <asiappl.h>
  21. #include <aseconst.h>
  22. #include <dbmain.h>
  23. #include "adsdef.h"
  24. /***************************************************************************/
  25. /* DEFINES */
  26. /***************************************************************************/
  27. #define CASEAPPL(x) ((CAseAppl*)x)
  28. #define CASELINKPATH(x) ((CAseLinkPath*)x)
  29. #define CASELINK(x) ((CAseLink*)x)
  30. #define CASELINKSEL(x) ((CAseLinkSel*)x)
  31. // Can be used to throw ASI exception with the
  32. // diagnostic parameters, containing in the specified
  33. // CAseApiObj-derived object
  34. #define ASE_THROW(x) {((CAseApiObj*)x)->appThrow() ;}
  35. #define WORKINGDWG() NULL
  36. /***************************************************************************/
  37. /* TYPEDEFS */
  38. /***************************************************************************/
  39. /***************************************************************************/
  40. /* CLASS DESCRIPTION */
  41. /***************************************************************************/
  42. #pragma pack (push, 8)
  43. #if defined(__cplusplus)
  44. class CAseApiErr ;
  45. class CAseApiObj ;
  46. class CAseAppl ;
  47. class CAseLinkPath ;
  48. class CAseLinkSel ;
  49. class CAseReactor ;
  50. class CAseApiObj
  51. //
  52. // This class defines the properties of the
  53. // all ASE classes and has to be inherited by the all
  54. // other concrete ASE API classes.
  55. //
  56. {
  57. public:
  58. CAseApiObj(CAseApiObj *pObj) ;
  59. CAseApiObj(CAseApiObj &Obj) ;
  60. virtual ~CAseApiObj() ;
  61. virtual EAsiBoolean init() ;
  62. virtual EAseApiClassId isA() const = 0 ;
  63. virtual CAseApiObj *clone() const = 0 ;
  64. virtual EAsiBoolean copyFrom(const CAseApiObj *pObj) ;
  65. virtual CAseApiObj& operator=(const CAseApiObj &Obj) ;
  66. virtual int operator==(const CAseApiObj *pObj) const = 0 ;
  67. virtual int operator==(const CAseApiObj &Obj) const = 0 ;
  68. virtual EAsiBoolean isInit() const ;
  69. const ACHAR *version() const ;
  70. const CAsiException *errGet() const ;
  71. int errQty() const ;
  72. EAseErrDsc errDsc(int ErrNum) const ;
  73. int errCode(int ErrNum) const ;
  74. EAsiBoolean errMsg(int ErrNum,
  75. ACHAR *pBuf,
  76. int BufLen) const;
  77. EAsiBoolean errClear() ;
  78. void appThrow() const ;
  79. const ACHAR *errDiagParNameCode(int ParNum,
  80. int *pParCode,
  81. int *pIsStr) const ;
  82. EAsiBoolean errDiagPar(int ErrNum,
  83. int ParCode,
  84. int *pIntValue) const ;
  85. EAsiBoolean errDiagPar(int ErrNum,
  86. int ParCode,
  87. ACHAR *pStrValue,
  88. int BufLen) const ;
  89. // Initialize the diagnostics area by ASI errors.
  90. EAsiBoolean errInitAsi(CAsiException *pErr) ;
  91. EAsiBoolean errInitAsi(CAsiSQLObject *pSQLObj) ;
  92. EAsiBoolean errInitAsi(CAsiSQLObject &sqlObj) ;
  93. friend class CAseApiErr ;
  94. friend class CAseAppl ;
  95. protected:
  96. struct resbuf *getLast(const struct resbuf *bufptr) const ;
  97. struct resbuf *allocAttr(EAseLinkAttr attr, const ACHAR *pStr=NULL) const ;
  98. struct resbuf *copyBuf(const struct resbuf *bufptr,
  99. const struct resbuf *pBorder=NULL) const ;
  100. struct resbuf *nextAttr(const struct resbuf *bufptr) const ;
  101. struct resbuf *getAttrType(const struct resbuf *bufptr,
  102. EAseLinkAttr lattr) const ;
  103. const struct resbuf *getAttrPtr(const struct resbuf *bufptr,
  104. EAseLinkAttr lattr) const ;
  105. EAsiBoolean setAttrPtr(struct resbuf *bufptr,
  106. EAseLinkAttr LinkAttr,
  107. struct resbuf *pAttrValue) const ;
  108. struct resbuf *delAttrPtr(struct resbuf *bufptr,
  109. struct resbuf *pAttr) const ;
  110. EAsiBoolean parseLisp(struct resbuf *bufptr) ;
  111. CAseAppl *getAppl() const ;
  112. void freeStr(struct resbuf *pBuf) const ;
  113. EAsiBoolean isDiffChar() const ;
  114. void *mpErr ; // The error descriptor pointer
  115. } ;
  116. class CAseAppl : public CAseApiObj
  117. //
  118. // This class is responsible for the interface
  119. // with the ASE main module.
  120. //
  121. {
  122. public:
  123. CAseAppl(CAseApiObj *pObj=NULL) ;
  124. CAseAppl(CAseApiObj &Obj) ;
  125. virtual ~CAseAppl() ;
  126. virtual EAsiBoolean init() ;
  127. virtual EAseApiClassId isA() const ;
  128. virtual CAseApiObj *clone() const ;
  129. virtual EAsiBoolean copyFrom(const CAseApiObj *pObj) ;
  130. virtual CAseApiObj& operator=(const CAseApiObj &Obj) ;
  131. virtual int operator==(const CAseApiObj *pObj) const ;
  132. virtual int operator==(const CAseApiObj &Obj) const ;
  133. virtual EAsiBoolean isInit() const ;
  134. void term() ;
  135. //get the AutoCAD data source location
  136. //this location remains unchanged throughout
  137. //one AutoCAD session
  138. LPCTSTR getAcadDsPath();
  139. // Maps ASE global diagnostics area into the target CAseAppl object
  140. EAsiBoolean getAseErr() ;
  141. // Clears ASE global diagnostics area
  142. EAsiBoolean clearAseErr();
  143. // This function returns the ASI session
  144. // allocated in the current application
  145. CAsiSession* connectAse(CAsiAppl *pAppl,
  146. const TCHAR *pEnvName,
  147. const ACHAR *pUserName=NULL,
  148. const ACHAR *pPassWord=NULL,
  149. EAsiBoolean fPrompt = kAsiFalse) ;
  150. // Checks whether the ASE index exists and it is up to date for
  151. // the drawing database specified
  152. EAsiBoolean isIndexExist(AcDbDatabase *pDwg=NULL);
  153. EAsiBoolean isIndexUpToDate(AcDbDatabase *pDwg=WORKINGDWG());
  154. // Creates (writes) the ASE index in the drawing database specified
  155. EAsiBoolean createIndex(AcDbDatabase *pDwg=WORKINGDWG());
  156. // Erases the ASE index from the drawing database specified
  157. EAsiBoolean removeIndex(AcDbDatabase *pDwg=WORKINGDWG());
  158. // Overwrites global AutoCAD "save index" variable
  159. // mode argument controls ASE index save mode:
  160. // 0 - use AutoCAD setting for ASE index
  161. // 1 - always save ASE index regardless AutoCAd setting
  162. // 2 - do not save index. Ignore AutoCAD setting
  163. // 3 - return current index save setting
  164. // Function returns ASE "save index" setting before calling this
  165. // function.
  166. int setIndexSaveMode (int mode);
  167. EAsiBoolean openDwg(AcDbDatabase *pDwg=WORKINGDWG()) ;
  168. EAsiBoolean openLazyDwg(AcDbDatabase *pDwg=WORKINGDWG()) ;
  169. EAsiBoolean isDwgOpened(AcDbDatabase *pDwg=WORKINGDWG()) ;
  170. EAsiBoolean isDwgLazyOpened(AcDbDatabase *pDwg=WORKINGDWG()) ;
  171. EAsiBoolean closeDwg(AcDbDatabase *pDwg=WORKINGDWG()) ;
  172. // Swaps the references to linked entities
  173. // Should be followed right after AcDbObject::swapIdWith() call
  174. EAsiBoolean swapEntIds(AcDbObjectId objectId,
  175. AcDbObjectId otherId,
  176. AcDbDatabase *pDwg=WORKINGDWG());
  177. // Swaps the references to BTR
  178. // Should be followed right after AcDbObject::swapIdWith() call
  179. // for BTR
  180. EAsiBoolean swapBTRIds(AcDbObjectId blockId,
  181. AcDbObjectId otherId,
  182. AcDbDatabase *pDwg=WORKINGDWG());
  183. // Makes ASE store unread ASE link information from the entity,
  184. // for lazy opened source drawing
  185. EAsiBoolean loadLinks(AcDbEntity *pObj);
  186. EAsiBoolean loadLinks(AcDbObjectId objId);
  187. EAsiBoolean translateDataSource(DatasourceTranslationCode xCode,
  188. unsigned int buflen,
  189. const ACHAR * szFromEnv,
  190. const ACHAR * szFromCat,
  191. const ACHAR * szFromSchema,
  192. const ACHAR * szFromTable,
  193. const ACHAR * szFromLpn,
  194. ACHAR * szToEnv,
  195. ACHAR * szToCat,
  196. ACHAR * szToSchema,
  197. ACHAR * szToTable,
  198. ACHAR * szToLpn);
  199. // ASE Transactions - controls how ASE objects are stored into ASE link memory
  200. // UserManaged Transactions require that begin/commit/abort are used
  201. // Automatic Transactions are the default and are provided for backward compatibility
  202. // for every ASE object created/modified/deleted, a transaction is automatically
  203. // created around each ASE operation.
  204. // UserManaged Transactions provide better performance since the user can control
  205. // where to commit the ASE objects into ASE memory.
  206. EAsiBoolean beginAseTransaction();
  207. EAsiBoolean commitAseTransaction();
  208. EAsiBoolean abortAseTransaction();
  209. typedef enum {
  210. kTransAutomatic = 0, // automatic commit ASE objects per ASE operation [DEFAULT]
  211. kTransUserManaged, // user must specify begin/commit/abort around ASE operations
  212. } ETransactionMode;
  213. void setAseTransactionMode( ETransactionMode eMode );
  214. ETransactionMode getAseTransactionMode();
  215. protected:
  216. // ASE call
  217. struct resbuf * aseiCallAse(int funCode,
  218. struct resbuf* pParms,
  219. void *pErr,
  220. void *pAcDbDatabase=NULL,
  221. EAsiBoolean needFullOpen=kAsiFalse) ;
  222. // RX-RX communication
  223. struct resbuf * ase_invoke(int funCode,
  224. struct resbuf* pParms,
  225. void *pErr,
  226. void *pAse) ;
  227. struct resbuf * ase_fromAse(struct resbuf *pBuf) ;
  228. EAsiBoolean ase_toAse(struct resbuf *pBuf) ;
  229. EAsiBoolean addObj(const CAseApiObj *pObj) ;
  230. EAsiBoolean remObj(const CAseApiObj *pObj) ;
  231. EAsiBoolean mapErrFromAse(void *pAse, void *pErr);
  232. friend class CAseApiObj ;
  233. friend class CAseLinkPath ;
  234. friend class CAseLink ;
  235. friend class CAseLinkSel ;
  236. friend class CAseApiErr ;
  237. TCHAR *mpVersion ; // The ASE version
  238. void *mpRes ; // XMF file reference
  239. void *mpObjs ; // Attached objects list
  240. EAsiBoolean mIsDiffChar ; // ASE & ASE appl have the
  241. // different character sets (kAsiTrue)
  242. TCHAR *mpDefChar ; // ASE default character set
  243. // (NULL if the same as ASE has)
  244. ETransactionMode meTransMode; // Automatically committing ASE transactions
  245. // on Link/Label inserts, deletes, etc.
  246. } ;
  247. class CAseLinkPath : public CAseApiObj
  248. //
  249. // This class is responsible for the manipulations
  250. // with the Link Paths. The class can refer to the
  251. // one Link Path is its name is set or provide the
  252. // caller with the group manipulations with the
  253. // several Link Paths related with the Database
  254. // Object Path. The procesing functions execute
  255. // the actions over the single Link Path, if its
  256. // name is specified. Otherwise, some of the
  257. // functions execute the actions for all of Link
  258. // Paths, related with the Database Object for
  259. // specified path. If the Database Object Path is
  260. // empty or wasn't specified, some of the
  261. // functions execute the actions for all of Link
  262. // Paths in the current drawing.
  263. //
  264. {
  265. public:
  266. CAseLinkPath(CAseApiObj *pObj) ;
  267. CAseLinkPath(CAseApiObj &Obj) ;
  268. virtual ~CAseLinkPath() ;
  269. virtual EAsiBoolean init() ;
  270. virtual EAseApiClassId isA() const ;
  271. virtual CAseApiObj *clone() const ;
  272. virtual EAsiBoolean copyFrom(const CAseApiObj *pObj) ;
  273. virtual CAseApiObj& operator=(const CAseApiObj &Obj) ;
  274. virtual int operator==(const CAseApiObj *pObj) const ;
  275. virtual int operator==(const CAseApiObj &Obj) const ;
  276. virtual EAsiBoolean isInit() const ;
  277. EAsiBoolean initPath(const ACHAR *pPath) ;
  278. EAsiBoolean initName(const ACHAR *pName) ;
  279. EAsiBoolean initCurrent() ;
  280. EAsiBoolean reInit();
  281. EAsiBoolean setName(const ACHAR *pName,
  282. EAseDoNameCode NameCode=kAseLpnCode) ;
  283. EAsiBoolean getName(ACHAR *pBuf, int BufLen,
  284. EAseDoNameCode NameCode=kAseLpnCode) const ;
  285. int getNameSize(EAseDoNameCode NameCode=kAseLpnCode) const;
  286. int cmpName(const ACHAR *pName,
  287. EAseDoNameCode NameCode=kAseLpnCode) const ;
  288. int cmpName(const CAseLinkPath *pLinkPath,
  289. EAseDoNameCode NameCode=kAseLpnCode) const ;
  290. EAseDoNameCode getPathCode() const;
  291. int getStatus() const;
  292. EAsiBoolean isUpdatable() const ;
  293. EAsiBoolean getKeyDsc(CAsiRow **pKeyDsc) const;
  294. EAsiBoolean getKeyDsc(CAsiColumn **pKeyDsc[], int *pColQty) const;
  295. EAsiBoolean create(const CAsiRow *pKeyDsc) ;
  296. EAsiBoolean create(const CAsiRow &KeyDsc) ;
  297. EAsiBoolean create(const CAsiColumn *pKeyDsc[], int ColQty) ;
  298. EAsiBoolean erase() ;
  299. EAsiBoolean rename(const ACHAR *pLinkPathName) ;
  300. EAsiBoolean setCurrent() const ;
  301. struct resbuf *getLinkNames() const ;
  302. struct resbuf *getPaths(int Status) const ;
  303. // Manages the ASE connection
  304. EAsiBoolean connectAse(const ACHAR *pUsername=NULL,
  305. const ACHAR *pPassword=NULL,
  306. EAsiBoolean fPrompt=kAsiFalse) ;
  307. EAsiBoolean connectAseIniString (const ACHAR *pIniString);
  308. EAsiBoolean disconnectAse();
  309. // Check which ASI functionality is supported by the connected Env
  310. EAsiBoolean checkOp(ulong status) const;
  311. // Gets the description of the databas table
  312. EAsiBoolean getTableDsc(CAsiRow **pColumns) const;
  313. EAsiBoolean getTableDsc(CAsiColumn **pKeyDsc[],
  314. int *pColQty) const;
  315. // Creates the table
  316. EAsiBoolean createTable(const CAsiRow *pCols);
  317. EAsiBoolean createTable(const CAsiColumn *pCols[],
  318. int colNum);
  319. // Deletes the table from the database
  320. EAsiBoolean dropTable();
  321. // Updates the values of the table row specified by the key values
  322. EAsiBoolean updRow(const CAsiRow *pKey,
  323. const CAsiRow *pValue,
  324. long *pRowsQty=NULL) const;
  325. EAsiBoolean updRow(const CAsiColumn *pKey[],
  326. int numKeys,
  327. const CAsiColumn *pValue[],
  328. int numValues,
  329. long *pRowsQty=NULL) const;
  330. // Deletes the row specified by the key values
  331. EAsiBoolean delRow(const CAsiRow *pValue,
  332. long *pRowsQty=NULL) const;
  333. EAsiBoolean delRow(const CAsiColumn *pValue[],
  334. int numKeys,
  335. long *pRowsQty=NULL) const;
  336. // Adds the row to the table
  337. EAsiBoolean addRow(const CAsiRow *pValue) const;
  338. EAsiBoolean addRow(const CAsiColumn *pValue[],
  339. int numValues) const;
  340. // Gets the values of the table row specified by the key
  341. // values into the specified buffer
  342. EAsiBoolean getRow(const CAsiRow *pKeyValue,
  343. CAsiRow *pRowBuffer) const;
  344. // This function has to be called to specify the drawing
  345. // database where the Link Paths are be processed in
  346. EAsiBoolean setDwg(const AcDbDatabase *pDwg=WORKINGDWG()) ;
  347. // Gets the drawing database which the processed
  348. // Link Paths are situated in
  349. const AcDbDatabase* getDwg() const ;
  350. // Allocates the cursor. ASE has to be already connected to
  351. // the correspondent Env.
  352. // pKeyDsc contains the input values description,
  353. // pRowBuffer describes the output values
  354. // This method puts the cursor number by the pCursorNum address.
  355. EAsiBoolean allocCursor(const CAsiRow *pKeyDsc,
  356. const CAsiRow *pRow,
  357. long *pCursorNum) const;
  358. // Gets the values which were previously described in
  359. // allocCursor() call. Input key values
  360. // are specified by pKeyValue. The data types of
  361. // pKeyValue and pRowBuffer should correspond to the
  362. // pKeyDsc and pRowBuffer arguments of allocCursor().
  363. EAsiBoolean getCursorRow(long cursorNum,
  364. const CAsiRow *pKeyValue,
  365. CAsiRow *pRow) const;
  366. // Deallocates the cursor.
  367. EAsiBoolean delCursor(long cursorNum) const;
  368. protected:
  369. void *mpPath ; // The internal data pointer
  370. void *mpDwg ; // The drawing database pointer
  371. } ;
  372. class CAseLink : public CAseApiObj
  373. //
  374. // This is the base class, defining the common
  375. // responsibility of the concrete links.
  376. //
  377. {
  378. public:
  379. CAseLink(CAseApiObj *pObj) ;
  380. CAseLink(CAseApiObj &Obj) ;
  381. virtual ~CAseLink() ;
  382. virtual EAsiBoolean init() ;
  383. EAsiBoolean initType(EAseLinkType lType) ;
  384. EAsiBoolean initId(LinkID linkId) ;
  385. EAsiBoolean initEnt(const ACHAR *pName,
  386. const CAsiRow *pKeyValue,
  387. ads_name EntName) ;
  388. EAsiBoolean initEnt(const ACHAR *pName,
  389. const CAsiRow &KeyValue,
  390. ads_name EntName) ;
  391. EAsiBoolean initEnt(const ACHAR *pName,
  392. const CAsiColumn *pKeyValue[],
  393. int ColQty,
  394. ads_name EntName) ;
  395. EAsiBoolean initDA(const ACHAR *pName,
  396. const CAsiRow *pKeyValue,
  397. const CAsiRow *pDACols,
  398. const struct resbuf *pDAParms) ;
  399. EAsiBoolean initDA(const ACHAR *pName,
  400. const CAsiRow &KeyValue,
  401. const CAsiRow &DACols,
  402. const struct resbuf *pDAParms) ;
  403. EAsiBoolean initDA(const ACHAR *pName,
  404. const CAsiColumn *pKeyValue[],
  405. int ColQty,
  406. const CAsiColumn *pDACols[],
  407. int DAColQty,
  408. const struct resbuf *pDAParms) ;
  409. virtual EAseApiClassId isA() const ;
  410. virtual CAseApiObj *clone() const ;
  411. virtual EAsiBoolean copyFrom(const CAseApiObj *pObj) ;
  412. virtual CAseApiObj& operator=(const CAseApiObj &Obj) ;
  413. virtual int operator==(const CAseApiObj *pObj) const ;
  414. virtual int operator==(const CAseApiObj &Obj) const ;
  415. virtual EAsiBoolean isInit() const ;
  416. LinkID getId () const ;
  417. EAseLinkType getType() const ;
  418. EAsiBoolean getName(ACHAR *pBuf, int len) const;
  419. int getNameSize() const ;
  420. EAsiBoolean setName(const ACHAR *pName) ;
  421. EAsiBoolean getEntity(ads_name EntName) const ;
  422. EAsiBoolean setEntity(ads_name EntName) ;
  423. EAsiBoolean getKey(CAsiRow *pKeyValue) const ;
  424. EAsiBoolean getKey(CAsiRow &KeyValue) const ;
  425. EAsiBoolean getKey(CAsiColumn *pKeyValue[], int ColQty) const ;
  426. EAsiBoolean setKey(const CAsiRow *pKeyValue) ;
  427. EAsiBoolean setKey(const CAsiRow &KeyValue) ;
  428. EAsiBoolean setKey(const CAsiColumn *pKeyValue[], int ColQty) ;
  429. EAsiBoolean setDACols (const CAsiRow *pCols) ;
  430. EAsiBoolean setDACols (const CAsiRow &Cols) ;
  431. EAsiBoolean setDACols(CAsiColumn *pCols[], int ColQty) ;
  432. EAsiBoolean getDACols (CAsiRow **pCols) const ;
  433. EAsiBoolean getDACols(CAsiColumn **pCols[], int *pColQty) const ;
  434. EAsiBoolean setDAParms(const struct resbuf *pParms) ;
  435. EAsiBoolean setDAValues(const CAsiRow *pDAValues) ;
  436. EAsiBoolean setDAValues(const CAsiRow &DAValues) ;
  437. EAsiBoolean setDAValues(CAsiColumn *pCols[], int ColQty) ;
  438. EAsiBoolean create () ;
  439. EAsiBoolean remove () ;
  440. EAsiBoolean update () ;
  441. EAsiBoolean getXName(ACHAR *pBuf, int len) const ;
  442. EAsiBoolean isUpdatable() const ;
  443. // This function has to be called to specify the drawing
  444. // database where the Link Paths are be processed in
  445. EAsiBoolean setDwg(const AcDbDatabase *pDwg=WORKINGDWG()) ;
  446. // Gets the drawing database which the processed
  447. // Link Paths are situated in
  448. const AcDbDatabase* getDwg() const ;
  449. // Un-documented
  450. // Gets/sets the link attribute values in the internal representation
  451. struct resbuf *getAttr(EAseLinkAttr LinkAttr) const ;
  452. EAsiBoolean setAttr(EAseLinkAttr LinkAttr,
  453. const struct resbuf *pAttrValue) ;
  454. private:
  455. struct resbuf *mpBuf ; // The link result buffer representation
  456. void *mpDwg ; // The drawing database pointer
  457. } ;
  458. class CAseLinkSel : public CAseApiObj
  459. //
  460. // This class describes the link selection.
  461. //
  462. {
  463. public:
  464. CAseLinkSel(CAseApiObj *pObj) ;
  465. CAseLinkSel(CAseApiObj &Obj) ;
  466. virtual ~CAseLinkSel() ;
  467. virtual EAsiBoolean init() ;
  468. EAsiBoolean initType(EAseLinkType LinkType) ;
  469. EAsiBoolean initSel(ads_name EntSelName,
  470. EAseLinkType LinkType=kAseUnknownLinkType) ;
  471. EAsiBoolean initEnt(ads_name EntName,
  472. EAseLinkType LinkType=kAseUnknownLinkType) ;
  473. EAsiBoolean initXName(const ACHAR *pXName,
  474. EAseLinkType LinkType=kAseUnknownLinkType) ;
  475. EAsiBoolean initLp(const ACHAR *pName,
  476. EAseLinkType LinkType=kAseUnknownLinkType) ;
  477. EAsiBoolean initLp(const CAseLinkPath *pLinkPath,
  478. EAseLinkType LinkType=kAseUnknownLinkType) ;
  479. EAsiBoolean initLp(const CAseLinkPath &LinkPath,
  480. EAseLinkType LinkType=kAseUnknownLinkType) ;
  481. EAsiBoolean initLpEnt(const ACHAR *pName,
  482. ads_name EntName,
  483. EAseLinkType LinkType=kAseUnknownLinkType) ;
  484. EAsiBoolean initLpEnt(const CAseLinkPath *pLinkPath,
  485. ads_name EntName,
  486. EAseLinkType LinkType=kAseUnknownLinkType) ;
  487. EAsiBoolean initLpEnt(const CAseLinkPath &LinkPath,
  488. ads_name EntName,
  489. EAseLinkType LinkType=kAseUnknownLinkType) ;
  490. EAsiBoolean initLpKey(const ACHAR *pName,
  491. const CAsiRow *pKeyValue,
  492. EAseLinkType LinkType=kAseUnknownLinkType) ;
  493. EAsiBoolean initLpKey(const ACHAR *pName,
  494. const CAsiRow &KeyValue,
  495. EAseLinkType LinkType=kAseUnknownLinkType) ;
  496. EAsiBoolean initLpKey(const CAseLinkPath *pLinkPath,
  497. const CAsiRow *pKeyValue,
  498. EAseLinkType LinkType=kAseUnknownLinkType) ;
  499. EAsiBoolean initLpKey(const CAseLinkPath &LinkPath,
  500. const CAsiRow &KeyValue,
  501. EAseLinkType LinkType=kAseUnknownLinkType) ;
  502. EAsiBoolean initLpKey(const ACHAR *pName,
  503. const CAsiColumn *pKeyValue[],
  504. int ColQty,
  505. EAseLinkType LinkType=kAseUnknownLinkType) ;
  506. EAsiBoolean initLpKey(const CAseLinkPath *pLinkPath,
  507. const CAsiColumn *pKeyValue[],
  508. int ColQty,
  509. EAseLinkType LinkType=kAseUnknownLinkType) ;
  510. EAsiBoolean initLpCond(const ACHAR *pName,
  511. const ACHAR *pTextCondition,
  512. EAseLinkType LinkType=kAseUnknownLinkType) ;
  513. EAsiBoolean initLpCond(const CAseLinkPath *pLinkPath,
  514. const ACHAR *pTextCondition,
  515. EAseLinkType LinkType=kAseUnknownLinkType) ;
  516. EAsiBoolean initLpCond(const CAseLinkPath &LinkPath,
  517. const ACHAR *pTextCondition,
  518. EAseLinkType LinkType=kAseUnknownLinkType) ;
  519. EAsiBoolean initLpSel(const ACHAR *pName,
  520. ads_name EntSelName,
  521. EAseLinkType LinkType=kAseUnknownLinkType) ;
  522. EAsiBoolean initLpSel(const CAseLinkPath *pLinkPath,
  523. ads_name EntSelName,
  524. EAseLinkType LinkType=kAseUnknownLinkType) ;
  525. EAsiBoolean initLpSel(const CAseLinkPath &LinkPath,
  526. ads_name EntSelName,
  527. EAseLinkType LinkType=kAseUnknownLinkType) ;
  528. EAsiBoolean initPartialKey(const ACHAR *pName,
  529. const CAsiRow *pKeyValue,
  530. EAseLinkType LinkType=kAseUnknownLinkType) ;
  531. EAsiBoolean initPartialKey(const CAseLinkPath *pLinkPath,
  532. const CAsiRow *pKeyValue,
  533. EAseLinkType LinkType=kAseUnknownLinkType) ;
  534. virtual EAseApiClassId isA() const ;
  535. virtual CAseApiObj *clone() const ;
  536. virtual EAsiBoolean copyFrom(const CAseApiObj *pObj) ;
  537. virtual CAseApiObj& operator=(const CAseApiObj &Obj) ;
  538. virtual int operator==(const CAseApiObj *pObj) const ;
  539. virtual int operator==(const CAseApiObj &Obj) const ;
  540. virtual EAsiBoolean isInit() const ;
  541. EAsiBoolean isUpdatable() const ;
  542. long getQty() const ;
  543. LinkID getId(long ItemNum) const ;
  544. EAsiBoolean addId(LinkID linkId) ;
  545. EAsiBoolean delId(long ItemNum) ;
  546. long membId(LinkID linkId) const ;
  547. EAsiBoolean unite(const CAseLinkSel *pSel) ;
  548. EAsiBoolean unite(const CAseLinkSel &Sel) ;
  549. EAsiBoolean subtract(const CAseLinkSel *pSel) ;
  550. EAsiBoolean subtract(const CAseLinkSel &Sel) ;
  551. EAsiBoolean intersect(const CAseLinkSel *pSel) ;
  552. EAsiBoolean intersect(const CAseLinkSel &Sel) ;
  553. EAsiBoolean intersectType(EAseLinkType LinkType) ;
  554. EAsiBoolean intersectEnt(ads_name EntName) ;
  555. EAsiBoolean intersectSel(ads_name EntSelName) ;
  556. EAsiBoolean intersectXName(const ACHAR *pXName) ;
  557. EAsiBoolean intersectLp(const ACHAR *pName) ;
  558. EAsiBoolean intersectLp(const CAseLinkPath *pLinkPath) ;
  559. EAsiBoolean intersectLp(const CAseLinkPath &LinkPath) ;
  560. EAsiBoolean intersectLpKey(const ACHAR *pName,
  561. const CAsiRow *pKeyValue) ;
  562. EAsiBoolean intersectLpKey(const ACHAR *pName,
  563. const CAsiRow &KeyValue) ;
  564. EAsiBoolean intersectLpKey(const CAseLinkPath *pLinkPath,
  565. const CAsiRow *pKeyValue) ;
  566. EAsiBoolean intersectLpKey(const CAseLinkPath &LinkPath,
  567. const CAsiRow &KeyValue) ;
  568. EAsiBoolean intersectLpKey(const ACHAR *pName,
  569. const CAsiColumn *pKeyValue[],
  570. int ColQty) ;
  571. EAsiBoolean intersectLpKey(const CAseLinkPath *pLinkPath,
  572. const CAsiColumn *pKeyValue[],
  573. int ColQty);
  574. EAsiBoolean intersectLpCond(const ACHAR *pName,
  575. const ACHAR *pTextCondition) ;
  576. EAsiBoolean intersectLpCond(const CAseLinkPath *pLinkPath,
  577. const ACHAR *pTextCondition) ;
  578. EAsiBoolean intersectLpCond(const CAseLinkPath &LinkPath,
  579. const ACHAR *pTextCondition) ;
  580. EAsiBoolean intersectPartialKey(const ACHAR *pName,
  581. const CAsiRow *pKeyValue) ;
  582. EAsiBoolean intersectPartialKey(const CAseLinkPath *pLinkPath,
  583. const CAsiRow *pKeyValue) ;
  584. // Gets the LPN of the link which identifier are specified
  585. // by means of ItemNum position in the link selection
  586. EAsiBoolean getLinkName(long ItemNum,
  587. TCHAR *pNameBuf,
  588. int nameBufLen) const;
  589. // Get the key value of the link
  590. // which identifier is specified by means of ItemNum position
  591. // in the link selection
  592. EAsiBoolean getLinkKey(long ItemNum, CAsiRow *pKeyValue);
  593. // Get the name of the entity having the link
  594. // which identifier is specified by means of ItemNum position
  595. // in the link selection
  596. EAsiBoolean getLinkEnt(long ItemNum, ads_name ename);
  597. // Adds the identifiers of the drawing objects
  598. // having the links which identifiers are contained
  599. // in the link selection
  600. int getIdArray(AcDbObjectIdArray *pLinkedEntities) const;
  601. // Get the identifier of the entity having the link
  602. // which identifier is specified by means of ItemNum position
  603. // in the link selection
  604. EAsiBoolean getLinkEnt(long ItemNum, AcDbObjectId *pId);
  605. // This function has to be called to specify the drawing
  606. // database where the links are processed in
  607. EAsiBoolean setDwg(const AcDbDatabase *pDwg=WORKINGDWG()) ;
  608. // Gets the drawing database which the processed
  609. // links are situated in
  610. const AcDbDatabase* getDwg() const ;
  611. struct resbuf *getXNames() const ;
  612. struct resbuf *getLinkNames() const ;
  613. EAsiBoolean getEntSel(ads_name EntSelName) const ;
  614. EAsiBoolean erase() ;
  615. // Un-documented
  616. // Initializes the link selection by the
  617. // internal link filter
  618. virtual EAsiBoolean initFilter(struct resbuf *pLinkFilter,
  619. EAsiBoolean needFullOpen=kAsiFalse) ;
  620. // Filters the link selection by the
  621. // internal link filter
  622. virtual EAsiBoolean intersectFilter(const struct resbuf *pLinkFilter) ;
  623. protected:
  624. void freeSel() ;
  625. struct resbuf *makeFilter(EAseLinkType LinkType,
  626. const ACHAR *pXName,
  627. ads_name EntName,
  628. ads_name EntSelName,
  629. const ACHAR *pName,
  630. const CAseLinkPath *pLinkPath,
  631. const CAsiRow *pKeyValue,
  632. const ACHAR *pTextCondition,
  633. const CAsiRow *pParKeyValue = NULL) ;
  634. LinkSelID mSelId ; // The link selection identifier
  635. void *mpDwg ; // The drawing database pointer
  636. } ;
  637. #endif /* __cplusplus */
  638. #pragma pack (pop)
  639. #endif /*_ASECLASS_H*/