(file) Return to Attribute.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

 1 karl  1.2 //%2004////////////////////////////////////////////////////////////////////////
 2           //
 3           // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 4           // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 5           // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
 6           // IBM Corp.; EMC Corporation, The Open Group.
 7           // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
 8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 9           //
10           // Permission is hereby granted, free of charge, to any person obtaining a copy
11           // of this software and associated documentation files (the "Software"), to
12           // deal in the Software without restriction, including without limitation the
13           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14           // sell copies of the Software, and to permit persons to whom the Software is
15           // furnished to do so, subject to the following conditions:
16           // 
17           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
18           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
19           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
20           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 karl  1.2 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25           //
26           //==============================================================================
27 david.dillard 1.1 //
28                   // Author: Tony Fiorentino (fiorentino_tony@emc.com)
29                   //
30                   // Modified By: Keith Petley (keithp@veritas.com)
31                   //
32                   //%/////////////////////////////////////////////////////////////////////////////
33                   
34                   #include "Attribute.h"
35                   
36                   PEGASUS_USING_STD;
37                   
38                   PEGASUS_NAMESPACE_BEGIN
39                   
40                   Attribute::Attribute(const String & attrEntry)
41                   {
42                       _tag = attrEntry;
43                   }
44                   
45                   Attribute::~Attribute()
46                   {
47                       if(_vals.size()) {
48 david.dillard 1.1         _vals.clear();	
49                       }
50                   }
51                   
52                   const Array <String> &
53                   Attribute::getValues() const
54                   {
55                       return _vals;
56                   }
57                   
58                   const String &
59                   Attribute::getTag() const
60                   {
61                       return _tag;
62                   }
63                   
64                   void
65                   Attribute::addValue(const String & value)
66                   {
67                       _vals.append(value);
68                   }
69 david.dillard 1.1 
70                   PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const Attribute& attr)
71                   {
72                       os << attr.getTag();
73                       Array <String> vals = attr.getValues();
74                       for(int i = 0; i < vals.size(); i++) {
75                           if(i == 0) {
76                               os << " = ";
77                           } else {
78                               os << " | ";
79                           }
80                           os << vals[i];
81                       }
82                       return os;
83                   }
84                   
85                   #define PEGASUS_ARRAY_T Attribute
86                   #include <Pegasus/Common/ArrayImpl.h>
87                   #undef PEGASUS_ARRAY_T
88                   
89                   PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2