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

File: [Pegasus] / pegasus / src / Pegasus / Common / Attic / LanguageElementRep.h (download)
Revision: 1.6, Tue Jun 21 18:35:35 2005 UTC (19 years ago) by kumpf
Branch: MAIN
CVS Tags: RELEASE_2_5_0-RC1, RELEASE_2_5_0, PEGASUS_2_5_0_PerformanceDev-string-end, PEGASUS_2_5_0_PerformanceDev-rootlt, PEGASUS_2_5_0_PerformanceDev-root, PEGASUS_2_5_0_PerformanceDev-r2, PEGASUS_2_5_0_PerformanceDev-r1, PEGASUS_2_5_0_PerformanceDev-lit-end, PEGASUS_2_5_0_PerformanceDev-buffer-end, PEGASUS_2_5_0_PerformanceDev-branch, PEGASUS_2_5_0_PerformanceDev-String, PEGASUS_2_5_0_PerformanceDev-AtomicInt-branch, NPEGASUS_2_5_0_PerformanceDev-String-root, NNPEGASUS_2_5_0_PerformanceDev-String-branch, BUG_4225_PERFORMANCE_VERSION_1_DONE
Changes since 1.5: +1 -1 lines
BUG#: 3853
TITLE: Assignment operators should return object references
DESCRIPTION: Fixed several assignment operator defects in language-related classes.

//%2005////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Humberto Rivero (hurivero@us.ibm.com)
//
// Modified By:  Aruran, IBM (ashanmug@in.ibm.com) for BUG# 3544
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef Pegasus_LanguageElementRep_h
#define Pegasus_LanguageElementRep_h

#include <cstdlib>
#include <cctype>
#include <iostream>
//#include <ostream>
#include <Pegasus/Common/Linkage.h>
#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/String.h>
#include <Pegasus/Common/Array.h>

#ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES

PEGASUS_NAMESPACE_BEGIN

//////////////////////////////////////////////////////////////
//
// LanguageElementRep::
//
//////////////////////////////////////////////////////////////
    
/** This is a base class for derived LanguageElements
 */ 
class PEGASUS_COMMON_LINKAGE LanguageElementRep{
	     
public:

	/**	This member is used to represent an empty LanguageElement. Using this 
        member avoids construction of an empty LanguageElement 
        (e.g., LanguageElement()).
    */
//	static const LanguageElement EMPTY;
	
	/**
	 * This member is used to notify callers of (Accept/Content)Languages::itrNext() that the end of the container
	 * has been reached and subsequent calls to (Accept/Content)Languages::itrNext() will fail.
	 */
//	static LanguageElement EMPTY_REF;

	/** Constructor
	 */
	LanguageElementRep();
	
	
	/**
	 * Constructor
	 * @param language String - language ex: en
	 * @param country String - country code ex: US
	 * @param variant String - variant ex: rab-oof
	 * @param quality Real32 - quality associated with the language, defaults to 1.0
	 */
	LanguageElementRep(String language, 
				 String country,
				 String variant,
				 Real32 quality = 1);

	/** 
	 * Constructor
	 * @param language_tag String language value
	 * @param quality Real32 quality associated with the language value, defaults to 1
	 */
	LanguageElementRep(String language_tag, Real32 quality = 1);

	/** Copy Constructor 
	 */
	LanguageElementRep(const LanguageElementRep &rhs);
	
	/**
	 * Destructor
	 */
	virtual ~LanguageElementRep();

	/**
	 * Assignment operator, deep copy
	 */
	LanguageElementRep& operator=(const LanguageElementRep & rhs);
	
	/** Gets the language value
	 * @return String - language
	 */
	String getLanguage() const;

	/**
	 * Gets the country value
	 * @return String - country
	 */
	String getCountry() const;

	/**
	 * Gets the variant value
	 * @return String variant
	 */
	String getVariant() const;
	
	/**
	 * Builds the language tag representation of this object
	 * @return String - language-country-variant 
	 */
	String getTag() const;
	
	/** String representation of the LanguageElement
	 * @return the String
	 */
	virtual String toString() const;
	
	/**
	 * Equality based on case INSENSITIVE comparison of the language tags
	 */
	Boolean operator==(const LanguageElementRep &rhs)const;
	
	/**
	 * Inequality based on case INSENSITIVE comparison of the language tags
	 */
	Boolean operator!=(const LanguageElementRep &rhs)const;
	
	Real32 getQuality()const;

	/**
	 * Writes the String representation of this object to the stream
	 */
	//PEGASUS_COMMON_LINKAGE friend PEGASUS_STD(ostream)& operator <<(PEGASUS_STD(ostream) &stream, LanguageElement le);

	/**
	 * AcceptLanguages needs direct access to quality, but ContentLanguages does not.
	 */
//	friend class AcceptLanguages;	

protected:
	String language;      // language part of language tag
        String country;       // country code part of the language tag
        String variant;       // language variant part of the language tag
        Real32 quality;                 // quality value of the languge tag
	
private:
	
	String buildLanguageTag() const;
	
	void splitLanguageTag(String language_tag);
	

}; // end LanguageElementRep

//#ifndef PEGASUS_ARRAY_T
//#define PEGASUS_ARRAY_T LanguageElement
//#include <Pegasus/Common/ArrayInter.h>
//#undef PEGASUS_ARRAY_T
//#endif

PEGASUS_NAMESPACE_END

#endif  // PEGASUS_USE_EXPERIMENTAL_INTERFACES

#endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2