Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more
Fork of NDefLib by
RecordVCard Class Reference
Specialize the RecordMimeType to store VCard information. More...
#include <RecordVCard.h>
Inherits NDefLib::RecordMimeType.
Public Types | |
| enum | VCardField_t { ADDRESS, ADDRESS_HOME, ADDRESS_WORK, AGENT, BIRDAY, CATEGORIES, EMAIL, EMAIL_HOME, EMAIL_WORK, FORMATTED_NAME, GEO, IMPP, PGPKEY_URL, PGPGKEY_BASE64, LOGO, LOGO_URI, LOGO_BASE64, NAME, NICKNAME, NOTE, ORGANIZATION, PHOTO_URI, PHOTO_BASE64, REVISION, SOURCE_URL, TEL, TEL_HOME, TEL_WORK, TEL_MOBILE, TITLE, URL } |
Type of information that you can store inside the tag. More... | |
| typedef std::map< VCardField_t, std::string > | VCardInfo_t |
| Type used to store the vcard information. | |
| enum | RecordType_t { TYPE_UNKNOWN, TYPE_TEXT, TYPE_AAR, TYPE_MIME, TYPE_URI, TYPE_URI_MAIL, TYPE_URI_SMS, TYPE_URI_GEOLOCATION, TYPE_MIME_VCARD, TYPE_WIFI_CONF } |
Enum used to identify the record type. More... | |
Public Member Functions | |
| RecordVCard (const VCardInfo_t &info=VCardInfo_t()) | |
| Create a record with the specific information. | |
| const std::string & | operator[] (const VCardField_t &type) const |
| Get the specific information stored in this record. | |
| std::string & | operator[] (const VCardField_t &type) |
| Get or set/change an information associated with this record. | |
| virtual RecordType_t | get_type () const |
| Get the record type. | |
| virtual uint16_t | get_byte_length () |
| virtual uint16_t | write (uint8_t *buffer) |
| Update the content and write it on the buffer. | |
| bool | operator== (const RecordVCard &other) |
| Compare two objects. | |
| void | set_as_first_record () |
| Set the record as the first record in the message. | |
| void | set_as_last_record () |
| Set the record as the last record in the message. | |
| bool | is_last_record () const |
| Check if it is the last record in the message. | |
| bool | is_first_record () const |
| Check if it is the first record in the message. | |
| void | set_as_middle_record () |
| Set the record as generic (not the first one and not the last one) | |
| bool | is_middle_record () const |
| Check if the record is in the middle of a chain. | |
| const RecordHeader & | get_header () const |
| Get the record header. | |
| const std::string & | get_mime_type () const |
| Return the mime type of the content. | |
| void | set_mime_data_pointer (uint8_t *data, uint32_t dataLength) |
| Change the data pointer used by this record. | |
| void | copy_mime_data (const uint8_t *data, uint32_t dataLength) |
| Change the data linked with this record, with this function the data are copied inside the object. | |
| uint32_t | get_mime_data_lenght () const |
| uint8_t const * | get_mime_data () const |
| bool | operator== (const RecordMimeType &other) const |
| Compare two objects. | |
Static Public Member Functions | |
| static RecordVCard * | parse (const RecordHeader &header, const uint8_t *buffer) |
| Create a RecordVCard reading the data from the buffer. | |
Detailed Description
Specialize the RecordMimeType to store VCard information.
This record handles the VCard version 3 format.
- See also:
- https://en.wikipedia.org/wiki/VCard
Definition at line 52 of file RecordVCard.h.
Member Typedef Documentation
| typedef std::map<VCardField_t, std::string> VCardInfo_t |
Type used to store the vcard information.
Definition at line 95 of file RecordVCard.h.
Member Enumeration Documentation
enum RecordType_t [inherited] |
Enum used to identify the record type.
- Enumerator:
| enum VCardField_t |
Type of information that you can store inside the tag.
- Enumerator:
Definition at line 58 of file RecordVCard.h.
Constructor & Destructor Documentation
| RecordVCard | ( | const VCardInfo_t & | info = VCardInfo_t() ) |
[explicit] |
Create a record with the specific information.
- Parameters:
-
Info optional information to store into the record.
Definition at line 59 of file RecordVCard.cpp.
Member Function Documentation
| void copy_mime_data | ( | const uint8_t * | data, |
| uint32_t | dataLength | ||
| ) | [inherited] |
Change the data linked with this record, with this function the data are copied inside the object.
- Parameters:
-
data Pointer to the data buffer. dataLength Number of bytes to write.
Definition at line 105 of file RecordMimeType.cpp.
| virtual uint16_t get_byte_length | ( | ) | [virtual] |
- Returns:
- update the record content and return the number of bytes needed to store this record
Reimplemented from Record.
Definition at line 149 of file RecordVCard.h.
| const RecordHeader& get_header | ( | ) | const [inherited] |
| uint8_t const* get_mime_data | ( | ) | const [inherited] |
- Returns:
- pointer to the content data
- DO NOT free this pointer, it is managed by the class.
Definition at line 124 of file RecordMimeType.h.
| uint32_t get_mime_data_lenght | ( | ) | const [inherited] |
- Returns:
- number of bytes used to store the content data
Definition at line 116 of file RecordMimeType.h.
| const std::string& get_mime_type | ( | ) | const [inherited] |
Return the mime type of the content.
- Returns:
- the mime type of the content.
Definition at line 87 of file RecordMimeType.h.
| virtual RecordType_t get_type | ( | ) | const [virtual] |
Get the record type.
- Returns:
- TYPE_MIME_VCARD
Reimplemented from RecordMimeType.
Definition at line 141 of file RecordVCard.h.
| bool is_first_record | ( | ) | const [inherited] |
| bool is_last_record | ( | ) | const [inherited] |
| bool is_middle_record | ( | ) | const [inherited] |
| bool operator== | ( | const RecordVCard & | other ) |
Compare two objects.
- Returns:
- true if the records have the same Vcard information
Definition at line 169 of file RecordVCard.h.
| bool operator== | ( | const RecordMimeType & | other ) | const [inherited] |
Compare two objects.
- Returns:
- true if the 2 records have the same mime type, length and data.
Definition at line 150 of file RecordMimeType.h.
| const std::string& operator[] | ( | const VCardField_t & | type ) | const |
Get the specific information stored in this record.
- Parameters:
-
Type type of information to get.
- Returns:
- if present, the information or an empty string
Definition at line 118 of file RecordVCard.h.
| std::string& operator[] | ( | const VCardField_t & | type ) |
Get or set/change an information associated with this record.
- Parameters:
-
type Type of information to change.
- Returns:
- reference to the string information
Definition at line 132 of file RecordVCard.h.
| RecordVCard * parse | ( | const RecordHeader & | header, |
| const uint8_t * | buffer | ||
| ) | [static] |
Create a RecordVCard reading the data from the buffer.
- Parameters:
-
header Record header. buffer Buffer to read the data from.
- Returns:
- an object of type RecordVCard or NULL
- User is in charge of freeing the pointer returned by this function.
Reimplemented from RecordMimeType.
Definition at line 105 of file RecordVCard.cpp.
| void set_as_first_record | ( | ) | [inherited] |
| void set_as_last_record | ( | ) | [inherited] |
| void set_as_middle_record | ( | ) | [inherited] |
| void set_mime_data_pointer | ( | uint8_t * | data, |
| uint32_t | dataLength | ||
| ) | [inherited] |
Change the data pointer used by this record.
- Parameters:
-
data Pointer used by this record. dataLength Number of byte to write in this record.
- The buffer is not copied or freed by this class.
- With this function only the data pointer is copied, so it must not be freed before the object is deallocated.
Definition at line 98 of file RecordMimeType.h.
| virtual uint16_t write | ( | uint8_t * | buffer ) | [virtual] |
Update the content and write it on the buffer.
- Parameters:
-
[out] buffer buffer to write the record content into.
- Returns:
- number of bytes written
- See also:
- Record::write
Reimplemented from RecordMimeType.
Definition at line 160 of file RecordVCard.h.
Generated on Tue Jul 12 2022 14:14:49 by
1.7.2
