FQName.cxx

Go to the documentation of this file.
00001 /**************************************************************************
00002  *
00003  * Copyright (C) 2008, Johns Hopkins University.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or
00007  * without modification, are permitted provided that the following
00008  * conditions are met:
00009  *
00010  *   - Redistributions of source code must contain the above
00011  *     copyright notice, this list of conditions, and the following
00012  *     disclaimer.
00013  *
00014  *   - Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions, and the following
00016  *     disclaimer in the documentation and/or other materials
00017  *     provided with the distribution.
00018  *
00019  *   - Neither the names of the copyright holders nor the names of any
00020  *     of any contributors may be used to endorse or promote products
00021  *     derived from this software without specific prior written
00022  *     permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00026  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00027  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00028  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00029  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00030  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00031  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00032  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00033  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00034  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  **************************************************************************/
00037 
00038 #include "FQName.hxx"
00039 
00040 using namespace std;
00041 
00042 const char FQName::sep = ':';
00043 const char FQName::LocalBindingSep = '.';
00044 
00045 bool
00046 FQName::operator<(const FQName& that) const
00047 {
00048   return (iface < that.iface ||
00049           (iface == that.iface && ident < that.ident));
00050 }
00051 
00052 bool
00053 FQName::operator>(const FQName& that) const
00054 {
00055   return (iface > that.iface ||
00056           (iface == that.iface && ident > that.ident));
00057 }
00058 
00059 bool
00060 FQName::operator==(const FQName& that) const
00061 {
00062   return (iface == that.iface && ident == that.ident);
00063 }
00064 
00065 FQName&
00066 FQName::operator=(const FQName& that)
00067 {
00068   iface = that.iface;
00069   ident = that.ident;
00070   return *this;
00071 }
00072 
00073 FQName::FQName(const std::string& nm)
00074 {
00075   string::size_type ifSep = nm.rfind(FQName::sep);
00076   iface = nm.substr(0, ifSep);
00077   ident = nm.substr(ifSep+1, nm.size());
00078 }
00079 
00080 
00081 std::string
00082 FQName::asString() const
00083 {
00084   if (iface.size())
00085     return (iface + FQName::sep + ident);
00086   else
00087     return ident;
00088 }

Generated on Sat Feb 4 23:59:28 2012 for BitC Compiler by  doxygen 1.4.7