• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • tdeabc
  • vcard
FloatValue.cpp
1 /*
2  libvcard - vCard parsing library for vCard version 3.0
3 
4  Copyright (C) 1998 Rik Hemsley rik@kde.org
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files (the "Software"), to
8  deal in the Software without restriction, including without limitation the
9  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  sell copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23 
24 #include <VCardFloatValue.h>
25 
26 #include <VCardValue.h>
27 
28 using namespace VCARD;
29 
30 FloatValue::FloatValue()
31  : Value()
32 {
33 }
34 
35 FloatValue::FloatValue(float f)
36  : Value (),
37  value_ (f)
38 {
39  parsed_ = true;
40 }
41 
42 FloatValue::FloatValue(const FloatValue & x)
43  : Value(x)
44 {
45  value_ = x.value_;
46 }
47 
48 FloatValue::FloatValue(const TQCString & s)
49  : Value(s)
50 {
51 }
52 
53  FloatValue &
54 FloatValue::operator = (FloatValue & x)
55 {
56  if (*this == x) return *this;
57 
58  x.parse();
59  value_ = x.value_;
60 
61  Value::operator = (x);
62  return *this;
63 }
64 
65  FloatValue &
66 FloatValue::operator = (const TQCString & s)
67 {
68  Value::operator = (s);
69  return *this;
70 }
71 
72  bool
73 FloatValue::operator == (FloatValue & x)
74 {
75  x.parse();
76  return (value_ == x.value_);
77 }
78 
79 FloatValue::~FloatValue()
80 {
81 }
82 
83  void
84 FloatValue::_parse()
85 {
86  bool negative(false);
87 
88  if (strRep_[0] == '-' || strRep_[1] == '+') {
89 
90  if (strRep_[0] == '-')
91  negative = true;
92 
93  strRep_.remove(0, 1);
94  }
95 
96  value_ = strRep_.toFloat();
97  if (negative)
98  value_ = -value_;
99 }
100 
101  void
102 FloatValue::_assemble()
103 {
104  strRep_ = TQCString().setNum(value_);
105 }
106 
107  float
108 FloatValue::value()
109 {
110  parse();
111  return value_;
112 }
113 
114  void
115 FloatValue::setValue(float f)
116 {
117  parsed_ = true;
118  value_ = f;
119 }
120 
VCARD
Definition: VCardAdrParam.h:32

tdeabc

Skip menu "tdeabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.8.8
This website is maintained by Timothy Pearson.