KWin
Loading...
Searching...
No Matches
Public Member Functions | List of all members
KWin::Xcb::Property Class Reference

#include <xcbutils.h>

Inheritance diagram for KWin::Xcb::Property:
KWin::Xcb::Wrapper< PropertyData, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t > KWin::Xcb::AbstractWrapper< Data > KWin::Xcb::StringProperty KWin::Xcb::TransientFor

Public Member Functions

 Property ()
 
 Property (const Property &other)
 
 Property (uint8_t _delete, xcb_window_t window, xcb_atom_t property, xcb_atom_t type, uint32_t long_offset, uint32_t long_length)
 
Propertyoperator= (const Property &other)
 
template<typename T >
std::enable_if<!std::is_pointer< T >::value, T >::type value (T defaultValue=T(), bool *ok=nullptr)
 Overloaded method for convenience.
 
template<typename T >
std::enable_if<!std::is_pointer< T >::value, T >::type value (uint8_t format, xcb_atom_t type, T defaultValue=T(), bool *ok=nullptr)
 Reads the property as a POD type.
 
template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type value (T defaultValue=nullptr, bool *ok=nullptr)
 Overloaded method for convenience.
 
template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type value (uint8_t format, xcb_atom_t type, T defaultValue=nullptr, bool *ok=nullptr)
 Reads the property as an array of T.
 
QByteArray toByteArray (uint8_t format=8, xcb_atom_t type=XCB_ATOM_STRING, bool *ok=nullptr)
 Reads the property as string and returns a QByteArray.
 
QByteArray toByteArray (bool *ok)
 Overloaded method for convenience.
 
bool toBool (uint8_t format=32, xcb_atom_t type=XCB_ATOM_CARDINAL, bool *ok=nullptr)
 Reads the property as a boolean value.
 
bool toBool (bool *ok)
 Overloaded method for convenience.
 
- Public Member Functions inherited from KWin::Xcb::Wrapper< PropertyData, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t >
 Wrapper ()=default
 
 Wrapper (Args... args)
 
 Wrapper (xcb_window_t w, Args... args)
 
- Public Member Functions inherited from KWin::Xcb::AbstractWrapper< Data >
virtual ~AbstractWrapper ()
 
AbstractWrapperoperator= (const AbstractWrapper &other)
 
const Replyoperator-> ()
 
bool isNull ()
 
bool isNull () const
 
 operator bool ()
 
 operator bool () const
 
const Replydata ()
 
const Replydata () const
 
WindowId window () const
 
bool isRetrieved () const
 
Replytake ()
 

Additional Inherited Members

- Public Types inherited from KWin::Xcb::AbstractWrapper< Data >
typedef Data::cookie_type Cookie
 
typedef Data::reply_type Reply
 
- Protected Member Functions inherited from KWin::Xcb::AbstractWrapper< Data >
 AbstractWrapper ()
 
 AbstractWrapper (WindowId window, Cookie cookie)
 
 AbstractWrapper (const AbstractWrapper &other)
 
void getReply ()
 

Detailed Description

Definition at line 707 of file xcbutils.h.

Constructor & Destructor Documentation

◆ Property() [1/3]

KWin::Xcb::Property::Property ( )
inline

Definition at line 710 of file xcbutils.h.

◆ Property() [2/3]

KWin::Xcb::Property::Property ( const Property & other)
inline

Definition at line 715 of file xcbutils.h.

◆ Property() [3/3]

KWin::Xcb::Property::Property ( uint8_t _delete,
xcb_window_t window,
xcb_atom_t property,
xcb_atom_t type,
uint32_t long_offset,
uint32_t long_length )
inlineexplicit

Definition at line 720 of file xcbutils.h.

Member Function Documentation

◆ operator=()

Property & KWin::Xcb::Property::operator= ( const Property & other)
inline

Definition at line 725 of file xcbutils.h.

◆ toBool() [1/2]

bool KWin::Xcb::Property::toBool ( bool * ok)
inline

Overloaded method for convenience.

Definition at line 893 of file xcbutils.h.

◆ toBool() [2/2]

bool KWin::Xcb::Property::toBool ( uint8_t format = 32,
xcb_atom_t type = XCB_ATOM_CARDINAL,
bool * ok = nullptr )
inline

Reads the property as a boolean value.

If the property reply length is 1 the first element is interpreted as a boolean value returning true for any value unequal to 0 and false otherwise.

In case of error this method returns false. Thus it is not possible to distinguish between error case and a read false value. Use the optional argument ok to distinguish the error case.

Parameters
formatExpected format. Defaults to 32.
typeExpected type Defaults to XCB_ATOM_CARDINAL.
okSet to false in case of error, true in case of success
Returns
bool The first element interpreted as a boolean value or false in error case
See also
value

Definition at line 876 of file xcbutils.h.

◆ toByteArray() [1/2]

QByteArray KWin::Xcb::Property::toByteArray ( bool * ok)
inline

Overloaded method for convenience.

Definition at line 856 of file xcbutils.h.

◆ toByteArray() [2/2]

QByteArray KWin::Xcb::Property::toByteArray ( uint8_t format = 8,
xcb_atom_t type = XCB_ATOM_STRING,
bool * ok = nullptr )
inline

Reads the property as string and returns a QByteArray.

In case of error this method returns a null QByteArray.

Definition at line 838 of file xcbutils.h.

◆ value() [1/4]

template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type KWin::Xcb::Property::value ( T defaultValue = nullptr,
bool * ok = nullptr )
inline

Overloaded method for convenience.

Uses the type which got passed into the ctor and derives the format from the sizeof(T). Note: for the automatic format detection the size of the type T may not vary between architectures. Thus one needs to use e.g. uint32_t instead of long. In general all xcb data types can be used, all Xlib data types can not be used.

Parameters
defaultValueThe default value to return in case of error
okSet to false in case of error, true in case of success
Returns
The read value or defaultValue in error case

Definition at line 785 of file xcbutils.h.

◆ value() [2/4]

template<typename T >
std::enable_if<!std::is_pointer< T >::value, T >::type KWin::Xcb::Property::value ( T defaultValue = T(),
bool * ok = nullptr )
inline

Overloaded method for convenience.

Uses the type which got passed into the ctor and derives the format from the sizeof(T). Note: for the automatic format detection the size of the type T may not vary between architectures. Thus one needs to use e.g. uint32_t instead of long. In general all xcb data types can be used, all Xlib data types can not be used.

Parameters
defaultValueThe default value to return in case of error
okSet to false in case of error, true in case of success
Returns
The read value or defaultValue in error case

Definition at line 745 of file xcbutils.h.

◆ value() [3/4]

template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type KWin::Xcb::Property::value ( uint8_t format,
xcb_atom_t type,
T defaultValue = nullptr,
bool * ok = nullptr )
inline

Reads the property as an array of T.

This method is an overload for the case that T is a pointer type.

Return the property value casted to the pointer type T. In case of format or type mismatch the defaultValue is returned. Also if the value length is 0 the defaultValue is returned. The optional argument ok is set to false in case of error and to true in case of successful reading of the property. Ok will always be true if the property exists and has been successfully read, even in the case the property is empty and its length is 0

Parameters
formatThe expected format of the property value, e.g. 32 for XCB_ATOM_CARDINAL
typeThe expected type of the property value, e.g. XCB_ATOM_CARDINAL
defaultValueThe default value to return in case of error
okSet to false in case of error, true in case of success
Returns
The read value or defaultValue in error case

Definition at line 808 of file xcbutils.h.

◆ value() [4/4]

template<typename T >
std::enable_if<!std::is_pointer< T >::value, T >::type KWin::Xcb::Property::value ( uint8_t format,
xcb_atom_t type,
T defaultValue = T(),
bool * ok = nullptr )
inline

Reads the property as a POD type.

Returns the first value of the property data. In case of format or type mismatch the defaultValue is returned. The optional argument ok is set to false in case of error and to true in case of successful reading of the property.

Parameters
formatThe expected format of the property value, e.g. 32 for XCB_ATOM_CARDINAL
typeThe expected type of the property value, e.g. XCB_ATOM_CARDINAL
defaultValueThe default value to return in case of error
okSet to false in case of error, true in case of success
Returns
The read value or defaultValue in error case

Definition at line 764 of file xcbutils.h.


The documentation for this class was generated from the following file: