Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117876877
kolabcontact.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
10 KB
Referenced Files
None
Subscribers
None
kolabcontact.h
View Options
/*
* Copyright (C) 2011 Christian Mollekopf <mollekopf@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KOLABCONTACT_H
#define KOLABCONTACT_H
#include
<string>
#include
<vector>
#include
<boost/scoped_ptr.hpp>
#include
"kolabcontainers.h"
namespace
Kolab
{
struct
NameComponents
{
bool
operator
==
(
const
NameComponents
&
other
)
const
{
return
mSurnames
==
other
.
mSurnames
&&
mGiven
==
other
.
mGiven
&&
mAdditional
==
other
.
mAdditional
&&
mPrefixes
==
other
.
mPrefixes
&&
mSuffixes
==
other
.
mSuffixes
;
};
void
setSurnames
(
const
std
::
vector
<
std
::
string
>
&
s
)
{
mSurnames
=
s
;
};
std
::
vector
<
std
::
string
>
surnames
()
const
{
return
mSurnames
;
};
void
setGiven
(
const
std
::
vector
<
std
::
string
>
&
s
)
{
mGiven
=
s
;
};
std
::
vector
<
std
::
string
>
given
()
const
{
return
mGiven
;
};
void
setAdditional
(
const
std
::
vector
<
std
::
string
>
&
s
)
{
mAdditional
=
s
;
};
std
::
vector
<
std
::
string
>
additional
()
const
{
return
mAdditional
;
};
void
setPrefixes
(
const
std
::
vector
<
std
::
string
>
&
s
)
{
mPrefixes
=
s
;
};
std
::
vector
<
std
::
string
>
prefixes
()
const
{
return
mPrefixes
;
};
void
setSuffixes
(
const
std
::
vector
<
std
::
string
>
&
s
)
{
mSuffixes
=
s
;
};
std
::
vector
<
std
::
string
>
suffixes
()
const
{
return
mSuffixes
;
};
bool
isValid
()
const
{
return
!
(
mSurnames
.
empty
()
&&
mGiven
.
empty
()
&&
mAdditional
.
empty
()
&&
mPrefixes
.
empty
()
&&
mSuffixes
.
empty
());
};
private
:
std
::
vector
<
std
::
string
>
mSurnames
;
std
::
vector
<
std
::
string
>
mGiven
;
std
::
vector
<
std
::
string
>
mAdditional
;
std
::
vector
<
std
::
string
>
mPrefixes
;
std
::
vector
<
std
::
string
>
mSuffixes
;
};
struct
Affiliation
{
bool
operator
==
(
const
Affiliation
&
other
)
const
{
return
mOrg
==
other
.
mOrg
&&
mLogo
==
other
.
mLogo
&&
mLogoMimetype
==
other
.
mLogoMimetype
&&
mTitles
==
other
.
mTitles
&&
mRoles
==
other
.
mRoles
&&
mManagers
==
other
.
mManagers
&&
mAssistants
==
other
.
mAssistants
&&
mOffices
==
other
.
mOffices
;
};
void
setOrganisation
(
const
std
::
string
&
org
)
{
mOrg
=
org
;
};
std
::
string
organisation
()
const
{
return
mOrg
;
};
// void setOrganisationalUnits(const std::vector<std::string> &units);
void
setLogo
(
const
std
::
string
&
l
,
const
std
::
string
mimetype
)
{
mLogo
=
l
;
mLogoMimetype
=
mimetype
;
};
std
::
string
logo
()
const
{
return
mLogo
;
};
std
::
string
logoMimetype
()
const
{
return
mLogoMimetype
;
};
void
setTitles
(
const
std
::
vector
<
std
::
string
>
&
titles
)
{
mTitles
=
titles
;
};
std
::
vector
<
std
::
string
>
titles
()
const
{
return
mTitles
;
};
void
setRoles
(
const
std
::
vector
<
std
::
string
>
&
roles
)
{
mRoles
=
roles
;
};
std
::
vector
<
std
::
string
>
roles
()
const
{
return
mRoles
;
};
void
setManagers
(
const
std
::
vector
<
std
::
string
>
&
managers
)
{
mManagers
=
managers
;
};
std
::
vector
<
std
::
string
>
managers
()
const
{
return
mManagers
;
};
void
setAssistants
(
const
std
::
vector
<
std
::
string
>
&
assistants
)
{
mAssistants
=
assistants
;
};
std
::
vector
<
std
::
string
>
assistants
()
const
{
return
mAssistants
;
};
void
setOffices
(
const
std
::
vector
<
std
::
string
>
&
offices
)
{
mOffices
=
offices
;
};
std
::
vector
<
std
::
string
>
offices
()
const
{
return
mOffices
;
};
private
:
std
::
string
mOrg
;
std
::
vector
<
std
::
string
>
mOrgUnits
;
std
::
string
mLogo
;
std
::
string
mLogoMimetype
;
std
::
vector
<
std
::
string
>
mTitles
;
std
::
vector
<
std
::
string
>
mRoles
;
std
::
vector
<
std
::
string
>
mManagers
;
std
::
vector
<
std
::
string
>
mAssistants
;
std
::
vector
<
std
::
string
>
mOffices
;
};
struct
Address
{
Address
()
:
mTypes
(
0
)
{};
enum
Type
{
Work
=
0x01
,
Home
=
0x02
};
bool
operator
==
(
const
Address
&
other
)
const
{
return
mTypes
==
other
.
mTypes
&&
mLabel
==
other
.
mLabel
&&
mStreet
==
other
.
mStreet
&&
mLocality
==
other
.
mLocality
&&
mRegion
==
other
.
mRegion
&&
mCode
==
other
.
mCode
&&
mCountry
==
other
.
mCountry
;
};
void
setTypes
(
int
t
)
{
mTypes
=
t
;
};
int
types
()
const
{
return
mTypes
;
};
void
setLabel
(
const
std
::
string
&
s
)
{
mLabel
=
s
;
};
std
::
string
label
()
const
{
return
mLabel
;
}
void
setStreet
(
const
std
::
string
&
s
)
{
mStreet
=
s
;
};
std
::
string
street
()
const
{
return
mStreet
;
};
void
setLocality
(
const
std
::
string
&
s
)
{
mLocality
=
s
;
};
std
::
string
locality
()
const
{
return
mLocality
;
};
void
setRegion
(
const
std
::
string
&
s
)
{
mRegion
=
s
;
};
std
::
string
region
()
const
{
return
mRegion
;
};
void
setCode
(
const
std
::
string
&
s
)
{
mCode
=
s
;
};
std
::
string
code
()
const
{
return
mCode
;
};
void
setCountry
(
const
std
::
string
&
s
)
{
mCountry
=
s
;
};
std
::
string
country
()
const
{
return
mCountry
;
};
private
:
int
mTypes
;
std
::
string
mLabel
;
std
::
string
mStreet
;
std
::
string
mLocality
;
std
::
string
mRegion
;
std
::
string
mCode
;
std
::
string
mCountry
;
};
struct
Related
{
// void setUri(const std::string &);
// std::string uri() const;
// void setText(const std::string &);
// std::string text() const;
// enum Type {
// Child,
// Spouse
// };
// void setType(Type t) { type = t; };
// Type type() const { return type; };
// private:
// std::string uri;
// std::string text;
// Type type;
};
struct
Telephone
{
enum
Type
{
Work
=
0x01
,
Home
=
0x02
,
Text
=
0x04
,
Voice
=
0x08
,
Fax
=
0x10
,
Cell
=
0x20
,
Video
=
0x40
,
Pager
=
0x80
,
Textphone
=
0x100
,
Car
=
0x200
};
Telephone
()
:
mType
(
0
){};
bool
operator
==
(
const
Telephone
&
other
)
const
{
return
mNumber
==
other
.
mNumber
&&
mType
==
other
.
mType
;
};
void
setTypes
(
int
t
)
{
mType
=
t
;
};
int
types
()
const
{
return
mType
;
};
void
setNumber
(
const
std
::
string
&
n
)
{
mNumber
=
n
;
};
std
::
string
number
()
const
{
return
mNumber
;
};
private
:
std
::
string
mNumber
;
int
mType
;
};
struct
Crypto
{
};
class
DistList
{
public
:
DistList
();
~
DistList
();
DistList
(
const
DistList
&
);
void
operator
=
(
const
DistList
&
);
void
setUid
(
const
std
::
string
&
);
std
::
string
uid
()
const
;
void
setLastModified
(
const
DateTime
&
);
DateTime
lastModified
()
const
;
void
setName
(
const
std
::
string
&
);
std
::
string
name
()
const
;
void
setMembers
(
const
std
::
vector
<
std
::
string
>
members
);
std
::
vector
<
std
::
string
>
members
()
const
;
void
setCustomProperties
(
const
std
::
vector
<
CustomProperty
>
&
);
std
::
vector
<
CustomProperty
>
customProperties
()
const
;
private
:
struct
Private
;
boost
::
scoped_ptr
<
Private
>
d
;
};
class
Contact
{
public
:
Contact
();
~
Contact
();
Contact
(
const
Contact
&
);
void
operator
=
(
const
Contact
&
);
void
setUid
(
const
std
::
string
&
);
std
::
string
uid
()
const
;
void
setLastModified
(
const
DateTime
&
);
DateTime
lastModified
()
const
;
void
setCategories
(
const
std
::
vector
<
std
::
string
>
&
);
void
addCategory
(
const
std
::
string
&
);
std
::
vector
<
std
::
string
>
categories
()
const
;
void
setName
(
const
std
::
string
&
);
std
::
string
name
()
const
;
void
setNameComponents
(
const
NameComponents
&
);
NameComponents
nameComponents
()
const
;
void
setNote
(
const
std
::
string
&
);
std
::
string
note
()
const
;
void
setFreeBusyUrl
(
const
std
::
string
&
);
std
::
string
freeBusyUrl
()
const
;
void
setAffiliations
(
const
std
::
vector
<
Affiliation
>
&
);
std
::
vector
<
Affiliation
>
affiliations
()
const
;
void
setUrls
(
const
std
::
vector
<
std
::
string
>
&
);
std
::
vector
<
std
::
string
>
urls
()
const
;
void
setAddresses
(
const
std
::
vector
<
Address
>
&
,
int
preferred
=
-1
);
std
::
vector
<
Address
>
addresses
()
const
;
int
addressPreferredIndex
()
const
;
void
setNickNames
(
const
std
::
vector
<
std
::
string
>
&
);
std
::
vector
<
std
::
string
>
nickNames
()
const
;
void
setRelateds
(
const
std
::
vector
<
Related
>
&
);
std
::
vector
<
Related
>
relateds
()
const
;
void
setBDay
(
const
DateTime
&
);
DateTime
bDay
()
const
;
void
setAnniversary
(
const
DateTime
&
);
DateTime
anniversary
()
const
;
void
setPhoto
(
const
std
::
string
&
data
,
const
std
::
string
&
mimetype
);
std
::
string
photo
()
const
;
std
::
string
photoMimetype
()
const
;
enum
Gender
{
NotSet
,
NotSpecified
,
Male
,
Female
};
void
setGender
(
Gender
);
Gender
gender
()
const
;
void
setLanguages
(
const
std
::
vector
<
std
::
string
>
&
);
std
::
vector
<
std
::
string
>
languages
()
const
;
void
setTelephones
(
const
std
::
vector
<
Telephone
>
&
,
int
preferredIndex
=
-1
);
std
::
vector
<
Telephone
>
telephones
()
const
;
int
telephonesPreferredIndex
()
const
;
void
setIMaddresses
(
const
std
::
vector
<
std
::
string
>
&
,
int
preferredIndex
=
-1
);
std
::
vector
<
std
::
string
>
imAddresses
()
const
;
int
imAddressPreferredIndex
()
const
;
void
setEmailAddresses
(
const
std
::
vector
<
std
::
string
>
&
,
int
preferredIndex
=
-1
);
std
::
vector
<
std
::
string
>
emailAddresses
()
const
;
int
emailAddressPreferredIndex
()
const
;
void
setGPSpos
(
const
std
::
vector
<
std
::
string
>
&
);
std
::
vector
<
std
::
string
>
gpsPos
()
const
;
void
setCrypto
(
const
Crypto
&
);
Crypto
crypto
()
const
;
void
setCustomProperties
(
const
std
::
vector
<
CustomProperty
>
&
);
std
::
vector
<
CustomProperty
>
customProperties
()
const
;
private
:
struct
Private
;
boost
::
scoped_ptr
<
Private
>
d
;
};
}
//Namespace
#endif
// KOLABCONTACT_H
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Apr 5, 9:18 PM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18827413
Default Alt Text
kolabcontact.h (10 KB)
Attached To
Mode
rLKX libkolabxml
Attached
Detach File
Event Timeline