class Connection

August 13, 2019 ยท View on GitHub

Member values

Member nameData typeDescription
user_handleUserProfileHandleUser profile handle, or set to zero if no user logged in
connection_informationstringConnection info (e.g. IP address with port number)
connection_identifieruint32Connection identifier

Member functions

Function nameReturn typeInput typeDescription
has_user_handle() constboolvoidReturns true if user_handle is set.
user_handle()const UserProfileHandle&voidReturns the current value of user_handle. If user_handle is not set, returns a UserProfileHandle with none of its fields set (possibly user_handle::default_instance()).
mutable_user_handle()UserProfileHandle *voidReturns a pointer to the mutable UserProfileHandle object that stores the field's value. If the field was not set prior to the call, then the returned UserProfileHandle will have none of its fields set (i.e. it will be identical to a newly-allocated UserProfileHandle). After calling this, has_user_handle() will return true and user_handle() will return a reference to the same instance of UserProfileHandle.
clear_user_handle()voidvoidClears the value of the field. After calling this, has_user_handle() will return false and user_handle() will return the default value.
set_allocated_user_handle()voidUserProfileHandle *Sets the UserProfileHandle object to the field and frees the previous field value if it exists. If the UserProfileHandle pointer is not NULL, the message takes ownership of the allocated UserProfileHandle object and has_ UserProfileHandle() will return true. Otherwise, if the user_handle is NULL, the behavior is the same as calling clear_user_handle().
release_user_handle()UserProfileHandle *voidReleases the ownership of the field and returns the pointer of the UserProfileHandle object. After calling this, caller takes the ownership of the allocated UserProfileHandle object, has_user_handle() will return false, and user_handle() will return the default value.
connection_information()const string&voidReturns the current value of connection_information. If connection_information is not set, returns the empty string/empty bytes.
set_connection_information()voidconst string&Sets the value of connection_information. After calling this, connection_information() will return a copy of value.
set_connection_information()voidstring&&(C++11 and beyond): Sets the value of connection_information, moving from the passed string. After calling this, connection_information() will return a copy of value.
set_connection_information()voidconst char*Sets the value of connection_information using a C-style null-terminated string. After calling this, connection_information() will return a copy of value.
mutable_connection_information()string *voidReturns a pointer to the mutable string object that stores connection_information's value. If the field was not set prior to the call, then the returned string will be empty. After calling this, connection_information() will return whatever value is written into the given string.
clear_connection_information()voidvoidClears the value of connection_information. After calling this, connection_information() will return the empty string/empty bytes.
set_allocated_connection_information()voidstring*Sets the string object to the field and frees the previous field value if it exists. If the string pointer is not NULL, the message takes ownership of the allocated string object. The message is free to delete the allocated string object at any time, so references to the object may be invalidated. Otherwise, if the value is NULL, the behavior is the same as calling clear_connection_information().
release_connection_information()string *voidReleases the ownership of connection_information and returns the pointer of the string object. After calling this, caller takes the ownership of the allocated string object and connection_information() will return the empty string/empty bytes.
connection_identifier()uint32voidReturns the current value of connection_identifier. If the connection_identifier is not set, returns 0.
set_connection_identifier()voiduint32Sets the value of connection_identifier. After calling this, connection_identifier() will return value.
clear_connection_identifier()voidvoidClears the value of connection_identifier. After calling this, connection_identifier() will return 0.

Parent topic: Common (C++)