Sha256: d461a2645c151328d8d2d72fdada2ad5c88254ebd9cc03dd515f71a65f959975

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

#pragma once
#include "ArrayHelper.h"
#include "StringHelper.h"

typedef struct _ElementInformation {
  int nativeWindowHandle;
  int* runtimeId;
  int runtimeIdLength;
  char* name;
  int controlTypeId;
  int* patterns;
  int patternsLength;
  char* id;

  _ElementInformation() : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL) {}

  _ElementInformation(Element^ element) : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL) {
    Update(element);
  }

  void Update(Element^ element) {
    Reset();
    id = StringHelper::ToUnmanaged(element->Id);
    name = StringHelper::ToUnmanaged(element->Name);
    nativeWindowHandle = element->NativeWindowHandle;
    runtimeId = ArrayHelper::FromArray(element->RuntimeId);
    runtimeIdLength = element->RuntimeId->Length;
    controlTypeId = element->ControlTypeId;
    patterns = ArrayHelper::FromArray(element->SupportedPatternIds);
    patternsLength = element->SupportedPatternIds->Length;
  }

  ~_ElementInformation() {
    Reset();
  }

private:
  void Reset() {
    delete[] name; delete[] runtimeId; delete[] patterns; delete[] id;
    name = NULL; runtimeId = NULL; patterns = NULL; id = NULL;
  }

} ElementInformation, *PElementInformation;

typedef struct _Elements {
  int length;
  ElementInformation* elements;

  _Elements() : length(0), elements(NULL) {}

  _Elements(array<Element^>^ elements) : elements(NULL) {
    length = elements->Length;
    if( length > 0 ) this->elements = new ElementInformation[length];

    auto index = 0;
    for each(auto element in elements) {
      this->elements[index++].Update(element);
    }
  }

  ~_Elements() {
    delete[] elements;
  }
} Elements, *PElements;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uia-0.0.5.1 ext/UiaDll/UiaDll/ElementStructures.h
uia-0.0.5 ext/UiaDll/UiaDll/ElementStructures.h