Acacia
AX API (MacOS)

Classes

class  acacia::AXAPINode
 

Enumerations

enum class  acacia::ValueType {
  NOT_PRESENT , UNKNOWN , LIST , BOOLEAN ,
  INT , FLOAT , STRING , URL ,
  NODE , POINT , SIZE , RECT ,
  RANGE , DICTIONARY , DATA , TEXTMARKER ,
  TEXTMARKERRANGE
}
 

Functions

AXAPINode acacia::findRootAXAPINodeForPID (int pid)
 
AXAPINode acacia::findRootAXAPINodeForName (const std::string &name)
 
 acacia::AXAPINode::AXAPINode ()
 
bool acacia::AXAPINode::isNull () const
 
std::vector< std::string > acacia::AXAPINode::getAttributeNames () const
 
bool acacia::AXAPINode::hasAttribute (const std::string &attribute) const
 
ValueType acacia::AXAPINode::getValueType (const std::string &attribute) const
 
ValueType acacia::AXAPINode::getListElementType (const std::string &attribute) const
 
int acacia::AXAPINode::getListElementCount (const std::string &attribute) const
 
bool acacia::AXAPINode::getBooleanValue (const std::string &attribute) const
 
int acacia::AXAPINode::getIntValue (const std::string &attribute) const
 
float acacia::AXAPINode::getFloatValue (const std::string &attribute) const
 
std::string acacia::AXAPINode::getStringValue (const std::string &attribute) const
 
std::string acacia::AXAPINode::getURLValue (const std::string &attribute) const
 
AXAPINode acacia::AXAPINode::getNodeValue (const std::string &attribute) const
 
Point acacia::AXAPINode::getPointValue (const std::string &attribute) const
 
Size acacia::AXAPINode::getSizeValue (const std::string &attribute) const
 
Rect acacia::AXAPINode::getRectValue (const std::string &attribute) const
 
Range acacia::AXAPINode::getRangeValue (const std::string &attribute) const
 
std::vector< AXAPINodeacacia::AXAPINode::getNodeListValue (const std::string &attribute) const
 
AXAPINode acacia::AXAPINode::getNodeListValueAtIndex (const std::string &attribute, int index) const
 
std::vector< std::string > acacia::AXAPINode::getStringListValue (const std::string &attribute) const
 
std::string acacia::AXAPINode::getStringListValueAtIndex (const std::string &attribute, int index) const
 
std::vector< Rangeacacia::AXAPINode::getRangeListValue (const std::string &attribute) const
 
Range acacia::AXAPINode::getRangeListValueAtIndex (const std::string &attribute, int index) const
 
std::vector< Dictionaryacacia::AXAPINode::getDictionaryListValue (const std::string &attribute) const
 
Dictionary acacia::AXAPINode::getDictionaryListValueAtIndex (const std::string &attribute, int index) const
 

Detailed Description

Accessiblity API for MacOS

Enumeration Type Documentation

◆ ValueType

enum acacia::ValueType
strong

Represents the types that various polymorphic getters may return.

Enumerator
UNKNOWN 

There is no value for the given parameter on this object.

LIST 

The value type couldn't be deduced.

BOOLEAN 

The value is a CFArrayRef. Values of this type are converted to a std::vector.

INT 

The value is a boolean.

FLOAT 

The value is an int.

STRING 

The value is a float.

URL 

The value is a CFStringRef. Values of this type are converted to std::string.

NODE 

The value is a CFURLRef. Values of this type are converted to std::string.

POINT 

The value is an AXUIElementRef. Values of this type are converted to an AXAPINode.

SIZE 

The value is a CGPoint. Values of this type are converted to a Point.

RECT 

The value is a CGSize. Values of this type are converted to a Size.

RANGE 

The value is a CGRect. Values of this type are converted to a Rect.

DICTIONARY 

The value is a CFRange. Values of this type are converted to a Range.

DATA 

The value is a CFDictionary. Values of this type are converted to a Dictionary.

TEXTMARKER 

The value is a CFDataRef.

TEXTMARKERRANGE 

The value is an AXTextMarker.

Function Documentation

◆ AXAPINode()

acacia::AXAPINode::AXAPINode ( )

Constructs a null AXAPINode.

Note: This is required for SWIG bindings to compile, but creates a node which doesn't wrap an AXUIElementRef, and will cause a crash when any of the accessor methods which depend on a valid AXUIElementRef are called.

◆ findRootAXAPINodeForName()

AXAPINode acacia::findRootAXAPINodeForName ( const std::string &  name)

Returns the root node of the tree of a running application with the given name.

Returns
An AXAPINode representing the root accessibility object for an application whose name matches the given name, or a null AXAPINode if no such application exists.

◆ findRootAXAPINodeForPID()

AXAPINode acacia::findRootAXAPINodeForPID ( int  pid)

Returns the root node of the tree of a running application with the given PID.

Returns
An AXAPINode representing the root accessibility object for the application with the given PID, or a null AXAPINode if no such application exists.

◆ getAttributeNames()

std::vector<std::string> acacia::AXAPINode::getAttributeNames ( ) const

Wraps AXUIElementCopyAttributeNames().

Returns
The list of attributes supported by this accessibility object. Note that it's not always the case that an attribute being supported indicates that the attribute is present.

◆ getBooleanValue()

bool acacia::AXAPINode::getBooleanValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::BOOLEAN.

◆ getDictionaryListValue()

std::vector<Dictionary> acacia::AXAPINode::getDictionaryListValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the values for an attribute whose value is a ValueType::LIST whose elements are ValueType::DICTIONARY values.

◆ getDictionaryListValueAtIndex()

Dictionary acacia::AXAPINode::getDictionaryListValueAtIndex ( const std::string &  attribute,
int  index 
) const

Wraps AXUIElementCopyAttributeValues.

Gets the individual value at the given index for an attribute whose value is a ValueType::LIST whose elements are ValueType::DICTIONARY values.

◆ getFloatValue()

float acacia::AXAPINode::getFloatValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::FLOAT.

◆ getIntValue()

int acacia::AXAPINode::getIntValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::INT.

◆ getListElementCount()

int acacia::AXAPINode::getListElementCount ( const std::string &  attribute) const

Wraps AXUIElementGetAttributeValueCount.

For attributes whose value is a ValueType::LIST, gets the number of list elements.

◆ getListElementType()

ValueType acacia::AXAPINode::getListElementType ( const std::string &  attribute) const

For attributes whose value is a ValueType::LIST, deduces the type of the list elements.

Returns
  • ValueType::NOT_PRESENT if the attribute is unsupported or not present on this object;
  • ValueType::UNKNOWN if the list has no elements, or the type of the elements couldn't be determined;
  • otherwise, the ValueType corresponding to the type of the attribute's value's list elements.

◆ getNodeListValue()

std::vector<AXAPINode> acacia::AXAPINode::getNodeListValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValues.

Gets the values for an attribute whose value is a ValueType::LIST whose elements are ValueType::NODE values.

◆ getNodeListValueAtIndex()

AXAPINode acacia::AXAPINode::getNodeListValueAtIndex ( const std::string &  attribute,
int  index 
) const

Wraps AXUIElementCopyAttributeValues.

Gets the individual value at the given index for an attribute whose value is a ValueType::LIST whose elements are ValueType::NODE values.

◆ getNodeValue()

AXAPINode acacia::AXAPINode::getNodeValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::NODE.

◆ getPointValue()

Point acacia::AXAPINode::getPointValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::POINT.

◆ getRangeListValue()

std::vector<Range> acacia::AXAPINode::getRangeListValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the values for an attribute whose value is a ValueType::LIST whose elements are ValueType::RANGE values.

◆ getRangeListValueAtIndex()

Range acacia::AXAPINode::getRangeListValueAtIndex ( const std::string &  attribute,
int  index 
) const

Wraps AXUIElementCopyAttributeValues.

Gets the individual value at the given index for an attribute whose value is a ValueType::LIST whose elements are ValueType::RANGE values.

◆ getRangeValue()

Range acacia::AXAPINode::getRangeValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::RANGE.

◆ getRectValue()

Rect acacia::AXAPINode::getRectValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::RECT.

◆ getSizeValue()

Size acacia::AXAPINode::getSizeValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::SIZE.

◆ getStringListValue()

std::vector<std::string> acacia::AXAPINode::getStringListValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValues.

Gets the values for an attribute whose value is a ValueType::LIST whose elements are ValueType::STRING values.

◆ getStringListValueAtIndex()

std::string acacia::AXAPINode::getStringListValueAtIndex ( const std::string &  attribute,
int  index 
) const

Wraps AXUIElementCopyAttributeValues.

Gets the individual value at the given index for an attribute whose value is a ValueType::LIST whose elements are ValueType::STRING values.

◆ getStringValue()

std::string acacia::AXAPINode::getStringValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::STRING.

◆ getURLValue()

std::string acacia::AXAPINode::getURLValue ( const std::string &  attribute) const

Wraps AXUIElementCopyAttributeValue.

Gets the value for an attribute whose value is a ValueType::URL.

◆ getValueType()

ValueType acacia::AXAPINode::getValueType ( const std::string &  attribute) const

Deduces the type of the given attribute's value on this accessibility object. This can be used to call the correct getter.

Note: Some attributes, such as "AXValue", have values of different types depending on the role of the accessibility object.

Returns
  • ValueType::NOT_PRESENT if the attribute is unsupported or not present on this object;
  • ValueType::UNKNOWN if the type was not one of the known types;
  • otherwise, the ValueType corresponding to the type of the attribute's value.

◆ hasAttribute()

bool acacia::AXAPINode::hasAttribute ( const std::string &  attribute) const

Checks whether the given attribute is present on this accessibility object.

Returns
true if the attribute is present.

◆ isNull()

bool acacia::AXAPINode::isNull ( ) const

Checks whether this AXAPINode wraps a valid AXUIElementRef.

Returns
true if this AXAPINode doesn't have a valid AXUIElementRef.