ICP  1
labview_xml.cpp
Go to the documentation of this file.
1 #include "stdafx.h"
2 
3 #include "labview_xml.h"
4 
5 //implement filestream that derives from IStream
6 class MemoryStream : public IStream
7 {
8 private:
9  char* m_buffer;
10  int m_pos;
11  int m_nbuffer;
12  LONG m_refcount;
13 
14 public:
15 
16  int toString(std::string& s)
17  {
18  m_buffer[m_pos] = '\0';
19  m_buffer[m_nbuffer-1] = '\0';
20  s = m_buffer;
21  return 0;
22  }
23 
25  {
26  m_refcount = 1;
27  m_nbuffer = 50000;
28  m_buffer = new char[m_nbuffer+1];
29  reset();
30  }
31 
32  void reset()
33  {
34  m_buffer[0] = '\0';
35  m_pos = 0;
36  }
37 
39  {
40  delete[] m_buffer;
41  m_buffer = 0;
42  m_pos = 0;
43  }
44 
45  virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void ** ppvObject)
46  {
47  if (iid == __uuidof(IUnknown)
48  || iid == __uuidof(IStream)
49  || iid == __uuidof(ISequentialStream))
50  {
51  *ppvObject = static_cast<IStream*>(this);
52  AddRef();
53  return S_OK;
54  } else
55  return E_NOINTERFACE;
56  }
57 
58  virtual ULONG STDMETHODCALLTYPE AddRef(void)
59  {
60  return (ULONG)InterlockedIncrement(&m_refcount);
61  }
62 
63  virtual ULONG STDMETHODCALLTYPE Release(void)
64  {
65  ULONG res = (ULONG) InterlockedDecrement(&m_refcount);
66  if (res == 0)
67  delete this;
68  return res;
69  }
70 
71  // ISequentialStream Interface
72 public:
73  virtual HRESULT STDMETHODCALLTYPE Read(void* pv, ULONG cb, ULONG* pcbRead)
74  {
75  if (m_pos + cb >= m_nbuffer)
76  {
77  *pcbRead = 0;
78  return E_FAIL;
79  }
80  memcpy(pv, m_buffer+m_pos, cb);
81  m_pos += cb;
82  *pcbRead = cb;
83  return S_OK;
84  }
85 
86  virtual HRESULT STDMETHODCALLTYPE Write(void const* pv, ULONG cb, ULONG* pcbWritten)
87  {
88  if (m_pos + cb >= m_nbuffer)
89  {
90  *pcbWritten = 0;
91  return E_FAIL;
92  }
93  memcpy(m_buffer+m_pos, pv, cb);
94  m_pos += cb;
95  *pcbWritten = cb;
96  return S_OK;
97  }
98 
99  // IStream Interface
100 public:
101  virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER)
102  {
103  return E_NOTIMPL;
104  }
105 
106  virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream*, ULARGE_INTEGER, ULARGE_INTEGER*,
107  ULARGE_INTEGER*)
108  {
109  return E_NOTIMPL;
110  }
111 
112  virtual HRESULT STDMETHODCALLTYPE Commit(DWORD)
113  {
114  return E_NOTIMPL;
115  }
116 
117  virtual HRESULT STDMETHODCALLTYPE Revert(void)
118  {
119  return E_NOTIMPL;
120  }
121 
122  virtual HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD)
123  {
124  return E_NOTIMPL;
125  }
126 
127  virtual HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD)
128  {
129  return E_NOTIMPL;
130  }
131 
132  virtual HRESULT STDMETHODCALLTYPE Clone(IStream **)
133  {
134  return E_NOTIMPL;
135  }
136 
137  virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER liDistanceToMove, DWORD dwOrigin,
138  ULARGE_INTEGER* lpNewFilePointer)
139  {
140  int oldpos = m_pos;
141  switch(dwOrigin)
142  {
143  case STREAM_SEEK_SET:
144  m_pos = liDistanceToMove.LowPart;
145  break;
146  case STREAM_SEEK_CUR:
147  m_pos += liDistanceToMove.LowPart;
148  break;
149  case STREAM_SEEK_END:
150  m_pos = m_nbuffer + liDistanceToMove.LowPart;
151  break;
152  default:
153  return STG_E_INVALIDFUNCTION;
154  break;
155  }
156  if (m_pos >= m_nbuffer)
157  {
158  m_pos = oldpos;
159  lpNewFilePointer->HighPart = 0;
160  lpNewFilePointer->LowPart = m_pos;
161  return E_FAIL;
162  }
163  lpNewFilePointer->HighPart = 0;
164  lpNewFilePointer->LowPart = m_pos;
165  return S_OK;
166  }
167 
168  virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG* pStatstg, DWORD grfStatFlag)
169  {
170  return E_NOTIMPL;
171  }
172 
173 };
174 
175 
176 // You might need to add the msxml4/sdk/(inc, lib) directories
177 // to the Tools->Options...->Directories in Visual Studio.
178 //
179 // You might also need to append "msxml2.lib" to the
180 // Project->Settings...->Link->Object/Libray Modules field.
181 
182 
183 
185 {
186  m_pxmldom = NULL;
187  std::cerr << "ERROR: Calling LabviewXML default constructor" << std::endl;
188 }
189 
190 // Helper function to create a DOM instance:
191 
192 
194 {
195  HRESULT hr;
196 // CoInitialize(NULL); DOMDocument40
197  STATUS_CHECK_HR( CoCreateInstance(__uuidof(DOMDocument),
198  NULL,
199  CLSCTX_INPROC_SERVER,
200  __uuidof(IXMLDOMDocument),
201  (void**)&m_pxmldom),
202  status);
203  if (m_pxmldom != NULL)
204  {
205  STATUS_CHECK_HR( m_pxmldom->put_async(VARIANT_FALSE), status);
206  STATUS_CHECK_HR( m_pxmldom->put_validateOnParse(VARIANT_FALSE), status);
207  STATUS_CHECK_HR( m_pxmldom->put_resolveExternals(VARIANT_FALSE), status);
208  return DAEstatus::Success;
209  }
210  else
211  {
212  return DAEstatus::Failure;
213  }
214 }
215 
216 int LabviewXML::processAllElements(bool reading, DAEstatus& status)
217 {
218  int i;
219  for(i=0; i<n_lv; i++)
220  {
221  processElements(i, reading, status);
222  }
223  return 0;
224 }
225 
226 int LabviewXML::processElements(int type, bool reading, DAEstatus& status)
227 {
228  IXMLDOMNodeList *main_list = NULL, *child_list = NULL;
229  IXMLDOMNode *main_node = NULL, *child_node = NULL, *parent_node = NULL;
230  long lCount = 0, nlist;
231  int i, j;
232  BSTR tag_name = SysAllocString(lv_tags[type]);
233  char name_tmp[256];
234  HRESULT hr;
235  hr = m_pxmldom->getElementsByTagName(tag_name, &main_list);
236  hr = main_list->get_length(&nlist);
237  BSTR bstr = NULL;
238  insert_t insert_ret;
239  iterator_t itty;
240  bool is_array_element;
241  char array_name[256];
242  for(itty = m_list.begin(); itty != m_list.end(); ++itty)
243  {
244  itty->second.index = 0;
245  }
246  for(i=0; i<nlist; i++)
247  {
248  is_array_element = false;
249  hr = main_list->get_item(i, &main_node);
250  hr = main_node->get_parentNode(&parent_node);
251  bstr = NULL;
252  hr = parent_node->get_nodeName(&bstr);
253  if (!wcscmp(L"Array", bstr))
254  {
255  SysFreeString(bstr);
256  bstr = NULL;
257  is_array_element = true;
258  hr = parent_node->get_firstChild(&child_node); // will be <Name> element for array
259  child_node->get_text(&bstr);
260  wcstombs(array_name, bstr, sizeof(array_name));
261  child_node->Release();
262  child_node = NULL;
263  }
264  SysFreeString(bstr);
265  parent_node->Release();
266  parent_node = NULL;
267  hr = main_node->get_childNodes(&child_list);
268  hr = child_list->get_length(&lCount);
269  name_tmp[0] = '\0';
270  for(j=0; j< lCount; j++)
271  {
272  bstr = NULL;
273  child_list->get_item(j, &child_node);
274  child_node->get_nodeName(&bstr);
275  if (!wcscmp(L"Name", bstr))
276  {
277  SysFreeString(bstr);
278  bstr = NULL;
279  child_node->get_text(&bstr);
280  wcstombs(name_tmp, bstr, sizeof(name_tmp));
281  }
282  else if (!wcscmp(L"Val", bstr))
283  {
284  SysFreeString(bstr);
285  bstr = NULL;
286  if (reading)
287  {
288  child_node->get_text(&bstr);
289  std::string my_name = (is_array_element ? array_name : name_tmp);
290  labview_item& item = m_list[my_name];
291  item.value.push_back(static_cast<const char*>(CW2CT(bstr)));
292  item.type = type;
293  }
294  else
295  {
296  if (is_array_element)
297  {
298  itty = m_list.find(array_name);
299  }
300  else
301  {
302  itty = m_list.find(name_tmp);
303  }
304  if (itty != m_list.end())
305  {
306  labview_item& item = itty->second;
307  if (item.index < item.value.size())
308  {
309  bstr = SysAllocString(CT2W(item.value[item.index].c_str()));
310  }
311  else
312  {
313  bstr = SysAllocString(CT2W(lv_defaults[item.type]));
314  }
315  child_node->put_text(bstr);
316  ++(item.index);
317  }
318  else
319  {
320  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "processElements: XML key \"%s\" not found", name_tmp);
321  }
322  }
323  }
324  if (bstr != NULL)
325  {
326  SysFreeString(bstr);
327  bstr = NULL;
328  }
329  child_node->Release();
330  child_node = NULL;
331  }
332  child_list->Release();
333  child_list = NULL;
334  main_node->Release();
335  main_node = NULL;
336  }
337  main_list->Release();
338  SysFreeString(tag_name);
339  return 0;
340 }
341 
342 int LabviewXML::setValue(const char* name, long value, DAEstatus& status)
343 {
344  char buffer[60];
345  sprintf(buffer, "%ld", value);
346  return setValue(name, buffer, status);
347 }
348 
349 int LabviewXML::setValue(const char* name, __int64 value, DAEstatus& status)
350 {
351  char buffer[60];
352  sprintf(buffer, "%ld", (long)value);
353  return setValue(name, buffer, status);
354 }
355 
356 int LabviewXML::setValue(const char* name, unsigned int value, DAEstatus& status)
357 {
358  char buffer[60];
359  sprintf(buffer, "%u", value);
360  return setValue(name, buffer, status);
361 }
362 
363 int LabviewXML::setValue(const char* name, unsigned long value, DAEstatus& status)
364 {
365  char buffer[60];
366  sprintf(buffer, "%lu", value);
367  return setValue(name, buffer, status);
368 }
369 
370 int LabviewXML::setValue(const char* name, int value, DAEstatus& status)
371 {
372  char buffer[60];
373  sprintf(buffer, "%d", value);
374  return setValue(name, buffer, status);
375 }
376 
377 
378 int LabviewXML::setValue(const char* name, double value, DAEstatus& status)
379 {
380  char buffer[60];
381  sprintf(buffer, "%g", value);
382  return setValue(name, buffer, status);
383 }
384 
385 int LabviewXML::setValue(const char* name, const std::vector<std::string>& value, DAEstatus& status)
386 {
387  iterator_t iterator;
388  iterator = m_list.find(name);
389  if (iterator != m_list.end())
390  {
391  (iterator->second).value = value;
392  }
393  else
394  {
395  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "XML array key \"%s\" not found", name);
396  }
397  return 1;
398 }
399 
400 // should use printf syle lv_format[(iterator->second).type] for writing
401 //
402 int LabviewXML::setValue(const char* name, const char* value, DAEstatus& status)
403 {
404  static bool ignore_missing = Poco::Util::Application::instance().config().getBool("isisicp.ignoremissingdashboardxml", true);
405  iterator_t iterator;
406  iterator = m_list.find(name);
407  if (iterator != m_list.end())
408  {
409  (iterator->second).value[0] = value;
410  }
411  else if (!ignore_missing)
412  {
413  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "setValue: XML key \"%s\" not found", name);
414  }
415  return 1;
416 }
417 
418 std::string LabviewXML::valueAsString(const char* name, DAEstatus& status)
419 {
420  std::string s;
421  getValue(name, s, status);
422  return s;
423 }
424 
425 int LabviewXML::getValue(const char* name, double& value, DAEstatus& status)
426 {
427  std::string s;
428  int stat = getValue(name, s, status);
429  value = atof(s.c_str());
430  return stat;
431 }
432 
433 int LabviewXML::getValue(const char* name, float& value, DAEstatus& status)
434 {
435  std::string s;
436  int stat = getValue(name, s, status);
437  value = static_cast<float>(atof(s.c_str()));
438  return stat;
439 }
440 
441 int LabviewXML::getValue(const char* name, long& value, DAEstatus& status)
442 {
443  std::string s;
444  int stat = getValue(name, s, status);
445  value = atol(s.c_str());
446  return stat;
447 }
448 
449 
450 int LabviewXML::getValue(const char* name, __int64& value, DAEstatus& status)
451 {
452  std::string s;
453  int stat = getValue(name, s, status);
454  value = atol(s.c_str());
455  return stat;
456 }
457 
458 int LabviewXML::getValue(const char* name, int& value, DAEstatus& status)
459 {
460  std::string s;
461  int stat = getValue(name, s, status);
462  value = atoi(s.c_str());
463  return stat;
464 }
465 
466 int LabviewXML::getValue(const char* name, std::vector<std::string>& value, DAEstatus& status)
467 {
468  c_iterator_t iterator;
469  iterator = m_list.find(name);
470  if (iterator != m_list.end())
471  {
472  value = (iterator->second).value;
473  return DAEstatus::Success;
474  }
475  else
476  {
477  value.clear();
478  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "XML array key \"%s\" not found", name);
479  return DAEstatus::Failure;
480  }
481 }
482 
483 int LabviewXML::getValue(const char* name, std::string& value, DAEstatus& status)
484 {
485  c_iterator_t iterator;
486  iterator = m_list.find(name);
487  if (iterator != m_list.end())
488  {
489  value = (iterator->second).value[0];
490  return DAEstatus::Success;
491  }
492  else
493  {
494  value = " ";
495  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "getValue: XML key \"%s\" not found", name);
496  return DAEstatus::Failure;
497  }
498 }
499 
500 int LabviewXML::getValue(const char* name, char* value, int max_len, bool write_null, DAEstatus& status)
501 {
502  int stat;
503  const char* tstr;
504  c_iterator_t iterator;
505  iterator = m_list.find(name);
506  if (iterator != m_list.end())
507  {
508  tstr = (iterator->second).value[0].c_str();
509  stat = DAEstatus::Success;
510  }
511  else
512  {
513  tstr = "";
514  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "getValue: XML key \"%s\" not found", name);
515  stat = DAEstatus::Failure;
516  }
517  strncpy(value, tstr, max_len);
518  if (write_null)
519  {
520  value[max_len-1] = '\0';
521  }
522  else // space pad
523  {
524  for(size_t i=strlen(tstr); i<max_len; i++)
525  {
526  value[i] = ' ';
527  }
528  }
529  return stat;
530 }
531 
532 // set ISO-8859-1 encoding - this is so accents etc. appear correctly in LabVIEW
534 {
535  IXMLDOMProcessingInstruction* pi = NULL;
536  if ( (m_pxmldom->createProcessingInstruction(L"xml", L" version='1.0' encoding='ISO-8859-1'", &pi) != S_OK) || (pi == NULL) )
537  {
538  status.add(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "LabviewXML: error creating encoding");
539  return DAEstatus::Failure;
540  }
541  IXMLDOMElement *root_element = NULL;
542  IXMLDOMNode *out_child = NULL;
543  m_pxmldom->get_documentElement(&root_element);
544  VARIANT v;
545  v.punkVal = root_element;
546  v.vt = VT_UNKNOWN;
547  if (m_pxmldom->insertBefore(pi, v, &out_child) != S_OK)
548  {
549  status.add(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "LabviewXML: error adding encoding");
550  }
551  if (out_child != NULL)
552  {
553  out_child->Release();
554  }
555  pi->Release();
556  root_element->Release();
557  return DAEstatus::Success;
558 }
559 
560 
561 int LabviewXML::saveToFile(const char* filename, DAEstatus& status)
562 {
563  processAllElements(false, status);
564  CComBSTR b(filename);
565  CComVariant v(b);
566 // setISO8859Encoding(status);
567  m_pxmldom->save(v);
568  return 0;
569 }
570 
571 //int LabviewXML::saveToString(BSTR* bstr, DAEstatus& status)
572 //{
573 // processAllElements(false, status);
574 // m_pxmldom->get_xml(bstr);
575 // return 0;
576 //}
577 
578 int LabviewXML::saveToString(std::string& s, DAEstatus& status)
579 {
580 // if (false)
581 // {
582 // BSTR b = NULL;
583 // saveToString(&b, status);
584 // s = COLE2CT(b);
585 // SysFreeString(b);
586 // b = NULL;
587 // }
588 // else
589 // {
590  processAllElements(false, status);
591  MemoryStream* ms = new MemoryStream;
592  VARIANT v;
593  VariantInit(&v);
594  v.vt = VT_UNKNOWN;
595  v.punkVal = ms;
596  setISO8859Encoding(status);
597  m_pxmldom->save(v);
598  ms->toString(s);
599  size_t n1 = s.find("<?xml");
600  size_t n2 = s.find("?>");
601  if (n1 != s.npos && n2 != s.npos)
602  {
603  s.erase(n1, 2+n2-n1); // labview does not like <?xml ?> line
604  }
605  delete ms;
606 // }
607  return 0;
608 }
609 
610 
611 int LabviewXML::loadFromString(const char* xml_string, DAEstatus& status)
612 {
613 // CComBSTR b(xml_string);
614  return loadFromString(CT2OLE(xml_string), status);
615 }
616 
617 int LabviewXML::loadFromString(BSTR xml_string, DAEstatus& status)
618 {
619  IXMLDOMParseError *pXMLErr=NULL;
620  IXMLDOMElement *element = NULL;
621  IXMLDOMNodeList *name_list = NULL, *value_list=NULL;
622  IXMLDOMNode* node = NULL;
623  BSTR bstr = NULL;
624  VARIANT_BOOL b_status = VARIANT_FALSE;
625  HRESULT hr;
626 
627  if (!m_pxmldom)
628  return DAEstatus::Failure;
629 
630 // VariantInit(&var);
631 // V_BSTR(&var) = SysAllocString(L"c:\test.txt");
632 // V_BSTR(&var) = SysAllocString(L"c:\test.txt");
633 // V_VT(&var) = VT_BSTR;
634 
635  STATUS_CHECK_HR(m_pxmldom->loadXML(xml_string ,&b_status), status);
636 // HRCALL(pXMLDom->load(var, &status), "");
637 
638  if (b_status!=VARIANT_TRUE) {
639  STATUS_CHECK_HR(m_pxmldom->get_parseError(&pXMLErr),status);
640  STATUS_CHECK_HR(pXMLErr->get_reason(&bstr),status);
641  long line, linePos;
642 
643  pXMLErr->get_line(&line);
644  pXMLErr->get_linepos(&linePos);
645  pXMLErr->get_errorCode(&hr);
646 
647  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "XML parse error %S at line %d char %d", bstr, line, linePos);
648  SysFreeString(bstr);
649  pXMLErr->Release();
650 
651  return DAEstatus::Failure;
652  }
653  processAllElements(true, status);
654 
655 
656 // processElements(pXMLDom, L"DBL", lab_file.dbl_list, lab_file.n_dbl, true);
657 //clean:
658 // if (bstr) SysFreeString(bstr);
659  // if (&var) VariantClear(&var);
660  // if (pXMLErr) pXMLErr->Release();
661  // if (pXMLDom) pXMLDom->Release();
662 // CoUninitialize();
663  return DAEstatus::Success;
664 }
665 
666 int LabviewXML::loadFromFile(const char* filename, DAEstatus& status)
667 {
668 // HRCALL(pXMLDom->load(var, &status), "");
669  int i, stat;
670  struct stat stat_struct;
671  FILE *f = _fsopen(filename, "rtN", _SH_DENYWR);
672  if (f == NULL)
673  {
674  status.addVa(FAC_DAE, SEV_ERROR, ERRTYPE_OUTOFMEM, "LabvieXML: cannot open \"%s\"", filename);
675  return DAEstatus::Failure;
676  }
677  fstat(fileno(f),&stat_struct);
678  char* buffer = new char[stat_struct.st_size+1];
679  int n = fread(buffer, 1, stat_struct.st_size, f);
680  fclose(f);
681  // labview can have nulls embedded
682  for(i=0; i<n; i++)
683  {
684  if (buffer[i] == '\0')
685  {
686  buffer[i] = ' ';
687  }
688  }
689  buffer[n] = '\0';
690  CComBSTR b(n, buffer);
691  stat = loadFromString(b, status);
692  delete[] buffer;
693  return stat;
694 }
695 
696 // copy all values in lvxml across to us, but keeping the rest of our content unchanged
697 int LabviewXML::updateFrom(const LabviewXML& lvxml, DAEstatus& status)
698 {
699  const char *name;
700  c_iterator_t iterator = lvxml.m_list.begin();
701  while(iterator != lvxml.m_list.end())
702  {
703  name = iterator->first.c_str();
704  const std::vector<std::string>& value = (iterator->second).value;
705  setValue(name, value, status);
706  ++iterator;
707  }
708  return DAEstatus::Success;
709 }
710 
711 int LabviewXML::updateFromString(const std::string& xml_string, DAEstatus& status)
712 {
713  return updateFromString(xml_string.c_str(), status);
714 }
715 
716 int LabviewXML::updateFromString(const char* xml_chars, DAEstatus& status)
717 {
718  LabviewXML lvxml(status);
719  if (lvxml.loadFromString(xml_chars, status) == DAEstatus::Success)
720  {
721  return updateFrom(lvxml, status);
722  }
723  else
724  {
725  return DAEstatus::Failure;
726  }
727 }
728 
int loadFromString(BSTR xml_string, DAEstatus &status)
std::string valueAsString(const char *name, DAEstatus &status)
virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER)
#define FAC_DAE
int setValue(const char *name, const char *value, DAEstatus &status)
int loadFromFile(const char *filename, DAEstatus &status)
#define ERRTYPE_OUTOFMEM
int addVa(int facility, int severity, int errtype, const char *format,...)
Definition: DAEstatus.cpp:54
int updateFromString(const std::string &xml_string, DAEstatus &status)
int setISO8859Encoding(DAEstatus &status)
char * m_buffer
Definition: labview_xml.cpp:9
static const int Failure
Definition: DAEstatus.h:141
int add(DAEstatus &dstatus, bool clear)
Definition: DAEstatus.cpp:131
list_t m_list
Definition: labview_xml.h:35
virtual HRESULT STDMETHODCALLTYPE Clone(IStream **)
int getValue(const char *name, char *value, int max_len, bool write_null, DAEstatus &status)
static const int Success
Definition: DAEstatus.h:140
static const char * lv_defaults[]
Definition: labview_xml.h:15
virtual HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead)
Definition: labview_xml.cpp:73
int updateFrom(const LabviewXML &lvxml, DAEstatus &status)
virtual HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD)
int DomFromCOM(DAEstatus &status)
int saveToString(std::string &s, DAEstatus &status)
#define SEV_ERROR
virtual HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD)
static const wchar_t * lv_tags[]
Definition: labview_xml.h:7
virtual HRESULT STDMETHODCALLTYPE Write(void const *pv, ULONG cb, ULONG *pcbWritten)
Definition: labview_xml.cpp:86
std::pair< list_t::iterator, bool > insert_t
Definition: labview_xml.h:32
virtual HRESULT STDMETHODCALLTYPE Revert(void)
int saveToFile(const char *filename, DAEstatus &status)
int processElements(int type, bool reading, DAEstatus &status)
virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER liDistanceToMove, DWORD dwOrigin, ULARGE_INTEGER *lpNewFilePointer)
virtual HRESULT STDMETHODCALLTYPE Commit(DWORD)
list_t::const_iterator c_iterator_t
Definition: labview_xml.h:34
#define STATUS_CHECK_HR(a, status)
Definition: DAEstatus.h:213
virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG *pStatstg, DWORD grfStatFlag)
int processAllElements(bool reading, DAEstatus &status)
std::vector< std::string > value
Definition: labview_xml.h:27
static const int n_lv
Definition: labview_xml.h:19
int toString(std::string &s)
Definition: labview_xml.cpp:16
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
Definition: labview_xml.cpp:45
list_t::iterator iterator_t
Definition: labview_xml.h:33
virtual ULONG STDMETHODCALLTYPE AddRef(void)
Definition: labview_xml.cpp:58
virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream *, ULARGE_INTEGER, ULARGE_INTEGER *, ULARGE_INTEGER *)
virtual ULONG STDMETHODCALLTYPE Release(void)
Definition: labview_xml.cpp:63
IXMLDOMDocument * m_pxmldom
Definition: labview_xml.h:23