[uClibc-cvs] CVS uClibc++/include

CVS User gkajmowi gkajmowi at codepoet.org
Mon Jan 3 16:28:48 UTC 2005


Update of /var/cvs/uClibc++/include
In directory nail:/tmp/cvs-serv29451/include

Modified Files:
	list map ostream ostream_helpers set string 
Added Files:
	iomanip 
Log Message:
Addition of <iomanip> as well as minor syntax error fixes all over.

--- /var/cvs/uClibc++/include/list	2004/12/23 16:06:44	1.6
+++ /var/cvs/uClibc++/include/list	2005/01/03 16:28:46	1.7
@@ -375,8 +375,8 @@
 	template<class T, class Allocator> void list<T, Allocator>::push_front(const T& x){
 		node * temp = new node(x);
 		list_start->previous = temp;
-		temp.previous = 0;
-		temp.next = list_start;
+		temp->previous = 0;
+		temp->next = list_start;
 		list_start = temp;
 		++elements;
 	}
--- /var/cvs/uClibc++/include/map	2004/09/17 02:47:50	1.5
+++ /var/cvs/uClibc++/include/map	2005/01/03 16:28:46	1.6
@@ -601,7 +601,7 @@
 		map<Key, T, Compare, Allocator>::operator=(const map<Key,T,Compare,Allocator>& x)
 	{
 		if( &x == this){
-			return this;
+			return *this;
 		}
 		c = x.c;
 		data = x.data;
--- /var/cvs/uClibc++/include/ostream	2004/12/18 22:00:45	1.6
+++ /var/cvs/uClibc++/include/ostream	2005/01/03 16:28:46	1.7
@@ -366,6 +366,33 @@
 #endif
 
 
+#ifndef __STRICT_ANSI__
+
+//Support for output of long long data types
+
+template<class Ch, class Tr> basic_ostream<Ch, Tr>& 
+	operator<<(basic_ostream<Ch, Tr>& os, signed long long int i)
+{
+	typename basic_ostream<Ch, Tr>::sentry s(os);
+	__ostream_printout<Tr, Ch, signed long long int>::printout(os, i);
+	return os;
+}
+
+
+template<class Ch, class Tr> basic_ostream<Ch, Tr>& 
+	operator<<(basic_ostream<Ch, Tr>& os, unsigned long long int i)
+{
+	typename basic_ostream<Ch, Tr>::sentry s(os);
+	__ostream_printout<Tr, Ch, unsigned long long int>::printout(os, i);
+	return os;
+}
+
+
+#endif	//__STRICT_ANSI__
+
+
+
+
 }
 
 
--- /var/cvs/uClibc++/include/ostream_helpers	2004/12/18 22:00:45	1.4
+++ /var/cvs/uClibc++/include/ostream_helpers	2005/01/03 16:28:46	1.5
@@ -113,6 +113,78 @@
 		}
 	};
 
+#ifndef __STRICT_ANSI__
+
+	template <class traits> class __ostream_printout<traits, char, signed long long int>{
+	public:
+		static void printout(basic_ostream<char, traits >& stream, const signed long long int n)
+		{
+			char buffer[28];
+			if( stream.flags() & ios_base::dec){
+				stream.write(buffer, snprintf(buffer, 27, "%lld", n));
+			}else if( stream.flags() & ios_base::oct){
+				if( stream.flags() & ios_base::showbase){
+					stream.write(buffer, snprintf(buffer, 27, "%#llo", n));
+				}else{
+					stream.write(buffer, snprintf(buffer, 27, "%llo", n) );
+				}
+			}else if (stream.flags() & ios_base::hex){
+				if(stream.flags() & ios_base::showbase){
+					if(stream.flags() & ios_base::uppercase){
+						stream.write(buffer, snprintf(buffer, 27, "%#llX", n) );
+					}else{
+						stream.write(buffer, snprintf(buffer, 27, "%#llx", n) );
+					}
+				}else{
+					if(stream.flags() & ios_base::uppercase){
+						stream.write(buffer, snprintf(buffer, 27, "%llX", n) );
+					}else{
+						stream.write(buffer, snprintf(buffer, 27, "%llx", n) );
+					}
+				}
+			}
+			if(stream.flags() & ios_base::unitbuf){
+				stream.flush();
+			}
+		}
+	};
+
+	template <class traits> class __ostream_printout<traits, char, unsigned long long int>{
+	public:
+		static void printout(basic_ostream<char, traits >& stream, const unsigned long long int n)
+		{
+			char buffer[28];
+			if( stream.flags() & ios_base::dec){
+				stream.write(buffer, snprintf(buffer, 27, "%llu", n));
+			}else if( stream.flags() & ios_base::oct){
+				if( stream.flags() & ios_base::showbase){
+					stream.write(buffer, snprintf(buffer, 27, "%#llo", n));
+				}else{
+					stream.write(buffer, snprintf(buffer, 27, "%llo", n) );
+				}
+			}else if (stream.flags() & ios_base::hex){
+				if(stream.flags() & ios_base::showbase){
+					if(stream.flags() & ios_base::uppercase){
+						stream.write(buffer, snprintf(buffer, 27, "%#llX", n) );
+					}else{
+						stream.write(buffer, snprintf(buffer, 27, "%#llx", n) );
+					}
+				}else{
+					if(stream.flags() & ios_base::uppercase){
+						stream.write(buffer, snprintf(buffer, 27, "%llX", n) );
+					}else{
+						stream.write(buffer, snprintf(buffer, 27, "%llx", n) );
+					}
+				}
+			}
+			if(stream.flags() & ios_base::unitbuf){
+				stream.flush();
+			}
+		}
+	};
+
+
+#endif	//__STRICT_ANSI__
 
 	template <class traits> class __ostream_printout<traits, char, double>{
 	public:
--- /var/cvs/uClibc++/include/set	2004/09/17 02:47:51	1.3
+++ /var/cvs/uClibc++/include/set	2005/01/03 16:28:46	1.4
@@ -593,7 +593,7 @@
 		set<Key, Compare, Allocator>::operator=(const set<Key, Compare, Allocator>& x)
 	{
 		if( &x == this){
-			return this;
+			return *this;
 		}
 		c = x.c;
 		data = x.data;
--- /var/cvs/uClibc++/include/string	2005/01/02 04:14:15	1.9
+++ /var/cvs/uClibc++/include/string	2005/01/03 16:28:46	1.10
@@ -490,16 +490,65 @@
 	size_type rfind(Ch c, size_type pos = npos) const{
 		return rfind(basic_string<Ch, Tr, A>(1,c),pos);
 	}
-/*	size_type find_first_of(const basic_string& str, size_type pos = 0) const;
-	size_type find_first_of(const charT* s, size_type pos, size_type n) const;
-	size_type find_first_of(const charT* s, size_type pos = 0) const;
-	size_type find_first_of(charT c, size_type pos = 0) const;
-	size_type find_last_of (const basic_string& str, size_type pos = npos) const;
-	size_type find_last_of (const charT* s, size_type pos, size_type n) const;
-	size_type find_last_of (const charT* s, size_type pos = npos) const;
-	size_type find_last_of (charT c, size_type pos = npos) const;
 
-	size_type find_first_not_of(const basic_string& str, size_type pos = 0) const;
+	size_type find_first_of(const basic_string& str, size_type pos = 0) const{
+		for(size_type i = pos; i < length(); ++i){
+			for(size_type j = 0; j < str.length() ; ++j){
+				if(str[j] == operator[](i) ){
+					return i;
+				}
+			}
+		}
+		return npos;
+	}
+
+	size_type find_first_of(const Ch* s, size_type pos, size_type n) const{
+		return find_first_of(basic_string<Ch, Tr, A>(s,n),pos);
+	}
+	size_type find_first_of(const Ch* s, size_type pos = 0) const{
+		return find_first_of(basic_string<Ch, Tr, A>(s),pos);
+	}
+	size_type find_first_of(Ch c, size_type pos = 0) const{
+		for(size_type i = pos; i< length(); ++i){
+			if(operator[](i) == c){
+				return i;
+			}
+		}
+		return npos;
+	}
+
+	size_type find_last_of (const basic_string& str, size_type pos = npos) const{
+		if(pos > length()){
+			pos = length();
+		}
+		for(size_type i = pos; i >0 ; --i){
+			for(size_type j = 0 ; j < str.length(); ++j){
+				if(operator[](i-1) == str[j]){
+					return i-1;
+				}
+			}
+		}
+		return npos;
+	}
+	size_type find_last_of (const Ch* s, size_type pos, size_type n) const{
+		return find_last_of(basic_string<Ch, Tr, A>(s,n),pos);
+	}
+	size_type find_last_of (const Ch* s, size_type pos = npos) const{
+		return fidn_last_of(basic_string<Ch, Tr, A>(s),pos);
+	}
+	size_type find_last_of (Ch c, size_type pos = npos) const{
+		if(pos > length()){
+			pos = length();
+		}
+		for(size_type i = pos; i >0 ; --i){
+			if(operator[](i-1) == c){
+				return i-1;
+			}
+		}
+		return npos;
+	}
+
+/*	size_type find_first_not_of(const basic_string& str, size_type pos = 0) const;
 	size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
 	size_type find_first_not_of(const charT* s, size_type pos = 0) const;
 	size_type find_first_not_of(charT c, size_type pos = 0) const;
@@ -673,7 +722,12 @@
 
 
 template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator>
-	operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+	operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs)
+{
+	basic_string<charT,traits,Allocator> temp(lhs);
+	temp.append(rhs);
+	return temp;
+}
 
 template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator>
 	operator+(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs)
@@ -684,7 +738,12 @@
 }
 
 template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator>
-	operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);
+	operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs)
+{
+	basic_string<charT,traits,Allocator> temp(lhs);
+	temp+=rhs;
+	return temp;
+}
 
 template<class charT, class traits, class Allocator> bool 
 	operator==(const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs)
@@ -873,81 +932,13 @@
 template<> basic_string<char, char_traits<char>, allocator<char> >
         operator+(const char* lhs, const basic_string<char, char_traits<char>, allocator<char> >& rhs);
 
-//#ifdef __UCLIBCXX_EXPAND_OSTREAM_CHAR__
-//template<> basic_ostream<char, char_traits<char> >&
-//	operator<<(basic_ostream<char, char_traits<char> >& os, 
-//	const basic_string<char,char_traits<char>, std::allocator<char> >& str);
-//#endif
-#endif
-#endif
-
-/*template<class charT, class traits, class Allocator> basic_istream<charT,traits>&
-	operator>>(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str)
-{
-
-	typename basic_istream<charT, traits>::sentry s(is);
-	if(s == false){
-		return is;
-	}
-
-	str.clear();
-
-	typename basic_istream<charT, traits>::int_type c;
-	typename Allocator::size_type n = is.width();
-	bool exitnow = false;
-	if(n == 0){
-		n = str.max_size();
-	}
-	do{
-		c = is.get();
-		if(c == traits::eof() || isspace(c) || n == 0){
-			exitnow = true;
-		}else{
-			str.append(1, traits::to_char_type(c) );
-			--n;
-		}
-	}while(exitnow == false);
-	return is;
-}
-
-template<class charT, class traits, class Allocator> basic_istream<charT,traits>&
-	getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str, charT delim)
-{
-	typename basic_istream<charT,traits>::sentry s;
-	streamsize i = 0;
-	typename basic_istream<charT,traits>::int_type c_i;
-	charT c;
-	unsigned int n = str.max_size();
-	for(i=0;i<n;++i){
-		c_i=is.get();
-		if(c_i == traits::eof() ){
-			return is;
-		}
-		c = traits::to_char_type(c_i);
-		if(c == delim){
-			return is;
-		}
-		str.append(c);
-	}
-	return is;	
-}
 
-template<class charT, class traits, class Allocator> basic_istream<charT,traits>&
-	getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str)
-{
-	return getline(is, str, '\n');
-}
+template<> basic_string<char, char_traits<char>, allocator<char> >
+        operator+(const basic_string<char, char_traits<char> , allocator<char> >& lhs,
+		const basic_string<char, char_traits<char>, allocator<char> >& rhs);
 
-#ifdef __UCLIBCXX_EXPAND_ISTREAM_CHAR__
-#ifdef __UCLIBCXX_EXPAND_STRING_CHAR__
-#ifndef __UCLIBCXX_COMPILE_STRING__
-template<> basic_istream<char, char_traits<char> >& operator>>(
-	basic_istream<char,char_traits<char> >& is,
-	basic_string<char, char_traits<char>, allocator<char> >& str);
-#endif
 #endif
 #endif
-*/
 
 typedef basic_string<char> string;
 typedef basic_string<wchar_t> wstring;



More information about the uClibc-cvs mailing list