summaryrefslogtreecommitdiffstats
path: root/src/vcard.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcard.rs')
-rw-r--r--src/vcard.rs92
1 files changed, 0 insertions, 92 deletions
diff --git a/src/vcard.rs b/src/vcard.rs
index 05d7498..fece8a2 100644
--- a/src/vcard.rs
+++ b/src/vcard.rs
@@ -7,78 +7,9 @@ use property::Property;
use std::result::Result as RResult;
use error::*;
-use param::Parameters;
pub struct Vcard(Component);
-macro_rules! make_getter_function_for_optional {
- ($fnname:ident, $name:expr, $mapper:ty) => {
- pub fn $fnname(&self) -> Option<$mapper> {
- self.0.get_only($name).cloned().map(From::from)
- }
- }
-}
-
-macro_rules! make_getter_function_for_values {
- ($fnname:ident, $name:expr, $mapper:ty) => {
- pub fn $fnname(&self) -> Vec<$mapper> {
- self.0
- .get_all($name)
- .iter()
- .map(Clone::clone)
- .map(From::from)
- .collect()
- }
- }
-}
-
-macro_rules! make_builder_fn {
- (
- fn $fnname:ident building $property_name:tt with_params,
- $mapfn:expr => $( $arg_name:ident : $arg_type:ty ),*
- ) => {
- pub fn $fnname(mut self, params: Parameters, $( $arg_name : $arg_type ),*) -> Self {
- let raw_value = vec![ $( $arg_name ),* ]
- .into_iter()
- .map($mapfn)
- .collect::<Vec<_>>()
- .join(";");
-
- let prop = Property {
- name: String::from($property_name),
- params: params,
- raw_value: raw_value,
- prop_group: None
- };
- self.0.props.entry(String::from($property_name)).or_insert(vec![]).push(prop);
- self
- }
- };
-
- (
- fn $fnname:ident building $property_name:tt,
- $mapfn:expr => $( $arg_name:ident : $arg_type:ty ),*
- ) => {
- pub fn $fnname(mut self, $( $arg_name : $arg_type ),*) -> Self {
- let raw_value = vec![ $( $arg_name ),* ]
- .into_iter()
- .map($mapfn)
- .collect::<Vec<_>>()
- .join(";");
-
- let prop = Property {
- name: String::from($property_name),
- params: BTreeMap::new(),
- raw_value: raw_value,
- prop_group: None
- };
- self.0.props.entry(String::from($property_name)).or_insert(vec![]).push(prop);
- self
- }
- }
-}
-
-
/// The Vcard object.
///
/// This type simply holds data and offers functions to access this data. It does not compute
@@ -205,29 +136,6 @@ impl Deref for Vcard {
}
}
-macro_rules! create_data_type {
- ( $name:ident ) => {
- #[derive(Eq, PartialEq)]
- pub struct $name(String, Parameters);
-
- impl $name {
- fn new(raw: String, params: Parameters) -> $name {
- $name(raw, params)
- }
-
- pub fn raw(&self) -> &String {
- &self.0
- }
- }
-
- impl From<Property> for $name {
- fn from(p: Property) -> $name {
- $name::new(p.raw_value, p.params)
- }
- }
- }
-}
-
create_data_type!(Adr);
create_data_type!(Anniversary);
create_data_type!(BDay);