summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.co.uk>2010-12-13 20:48:42 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.co.uk>2010-12-13 20:48:42 +0200
commit814f639fb955f99829285c255b66b694b94fbc64 (patch)
treed367b57004e00f976f6a06d87c24fb79a2046f84
parent915888ba70a8f61db16cf78a50e5ece1d4341481 (diff)
Move all the QDebug operator<<() inside the namespaces of their arguments.
C++'s Argument Dependent Lookup will take care of finding the right function to call. This avoids polluting the main mainspace and prevents possible ambiguous calls in case something can be implicitly cast to a QGlib/QGst class but we don't want it to.
-rw-r--r--src/QGlib/error.cpp6
-rw-r--r--src/QGlib/error.h6
-rw-r--r--src/QGlib/value.cpp7
-rw-r--r--src/QGlib/value.h7
-rw-r--r--src/QGst/buffer.cpp6
-rw-r--r--src/QGst/buffer.h6
-rw-r--r--src/QGst/caps.cpp6
-rw-r--r--src/QGst/caps.h6
-rw-r--r--src/QGst/event.cpp7
-rw-r--r--src/QGst/event.h12
-rw-r--r--src/QGst/message.cpp8
-rw-r--r--src/QGst/message.h12
-rw-r--r--src/QGst/query.cpp7
-rw-r--r--src/QGst/query.h12
-rw-r--r--src/QGst/structure.cpp6
-rw-r--r--src/QGst/structure.h6
16 files changed, 60 insertions, 60 deletions
diff --git a/src/QGlib/error.cpp b/src/QGlib/error.cpp
index 5bb84c4..d67fd44 100644
--- a/src/QGlib/error.cpp
+++ b/src/QGlib/error.cpp
@@ -70,9 +70,9 @@ QString Error::message() const
return QString::fromUtf8(m_error->message);
}
-} //namespace QGlib
-
-QDebug operator<<(QDebug dbg, const QGlib::Error & error)
+QDebug operator<<(QDebug dbg, const Error & error)
{
return dbg << error.message();
}
+
+} //namespace QGlib
diff --git a/src/QGlib/error.h b/src/QGlib/error.h
index 7da6843..d805ea6 100644
--- a/src/QGlib/error.h
+++ b/src/QGlib/error.h
@@ -66,9 +66,9 @@ private:
GError *m_error;
};
-} //namespace QGlib
-
/*! \relates QGlib::Error */
-QDebug operator<<(QDebug dbg, const QGlib::Error & error);
+QDebug operator<<(QDebug dbg, const Error & error);
+
+} //namespace QGlib
#endif // QGLIB_ERROR_H
diff --git a/src/QGlib/value.cpp b/src/QGlib/value.cpp
index 9178db9..ef90767 100644
--- a/src/QGlib/value.cpp
+++ b/src/QGlib/value.cpp
@@ -308,10 +308,7 @@ SharedValue & SharedValue::operator=(const SharedValue & other)
//END SharedValue
-} //namespace QGlib
-
-
-QDebug & operator<<(QDebug debug, const QGlib::ValueBase & value)
+QDebug & operator<<(QDebug debug, const ValueBase & value)
{
debug.nospace() << "QGlib::ValueBase";
if(!value.isValid()) {
@@ -334,3 +331,5 @@ QDebug & operator<<(QDebug debug, const QGlib::ValueBase & value)
return debug.space();
}
}
+
+} //namespace QGlib
diff --git a/src/QGlib/value.h b/src/QGlib/value.h
index 014225b..9b40694 100644
--- a/src/QGlib/value.h
+++ b/src/QGlib/value.h
@@ -402,10 +402,13 @@ public:
};
} //namespace Private
-} //namespace QGlib
+
+// -- QDebug operator --
/*! \relates QGlib::ValueBase */
-QDebug & operator<<(QDebug debug, const QGlib::ValueBase & value);
+QDebug & operator<<(QDebug debug, const ValueBase & value);
+
+} //namespace QGlib
QGLIB_REGISTER_TYPE(QGlib::ValueBase) //codegen: GType=G_TYPE_VALUE
QGLIB_REGISTER_TYPE(QGlib::Value)
diff --git a/src/QGst/buffer.cpp b/src/QGst/buffer.cpp
index 33aa189..58b8661 100644
--- a/src/QGst/buffer.cpp
+++ b/src/QGst/buffer.cpp
@@ -83,10 +83,10 @@ BufferPtr Buffer::copy() const
return BufferPtr::wrap(gst_buffer_copy(object<GstBuffer>()), false);
}
-} //namespace QGst
-
-QDebug operator<<(QDebug debug, const QGst::BufferPtr & buffer)
+QDebug operator<<(QDebug debug, const BufferPtr & buffer)
{
debug.nospace() << "QGst::Buffer(Size: " << buffer->size() << ")";
return debug.space();
}
+
+} //namespace QGst
diff --git a/src/QGst/buffer.h b/src/QGst/buffer.h
index 5b27c40..069c8ce 100644
--- a/src/QGst/buffer.h
+++ b/src/QGst/buffer.h
@@ -55,11 +55,11 @@ public:
};
+/*! \relates QGst::Buffer */
+QDebug operator<<(QDebug debug, const BufferPtr & buffer);
+
} //namespace QGst
QGLIB_REGISTER_TYPE(QGst::Buffer)
-/*! \relates QGst::Buffer */
-QDebug operator<<(QDebug debug, const QGst::BufferPtr & buffer);
-
#endif
diff --git a/src/QGst/caps.cpp b/src/QGst/caps.cpp
index 1c8c6ee..08d0e34 100644
--- a/src/QGst/caps.cpp
+++ b/src/QGst/caps.cpp
@@ -223,10 +223,10 @@ void Caps::makeWritable()
}
}
-} //namespace QGst
-
-QDebug operator<<(QDebug debug, const QGst::CapsPtr & caps)
+QDebug operator<<(QDebug debug, const CapsPtr & caps)
{
debug.nospace() << "QGst::Caps(" << caps->toString() << ")";
return debug.space();
}
+
+} //namespace QGst
diff --git a/src/QGst/caps.h b/src/QGst/caps.h
index 3a7d021..a83b6e1 100644
--- a/src/QGst/caps.h
+++ b/src/QGst/caps.h
@@ -76,11 +76,11 @@ protected:
virtual void unref();
};
+/*! \relates QGst::Caps */
+QDebug operator<<(QDebug debug, const CapsPtr & caps);
+
}
QGLIB_REGISTER_TYPE(QGst::Caps)
-/*! \relates QGst::Caps */
-QDebug operator<<(QDebug debug, const QGst::CapsPtr & caps);
-
#endif
diff --git a/src/QGst/event.cpp b/src/QGst/event.cpp
index 9310988..14cab2e 100644
--- a/src/QGst/event.cpp
+++ b/src/QGst/event.cpp
@@ -371,17 +371,16 @@ bool StepEvent::intermediate() const
return i;
}
-} //namespace QGst
-
-QDebug operator<<(QDebug debug, QGst::EventType type)
+QDebug operator<<(QDebug debug, EventType type)
{
debug.nospace() << gst_event_type_get_name(static_cast<GstEventType>(type));
return debug.space();
}
-QDebug operator<<(QDebug debug, const QGst::EventPtr & event)
+QDebug operator<<(QDebug debug, const EventPtr & event)
{
debug.nospace() << "QGst::Event(Type: " << event->type() << ")";
return debug.space();
}
+} //namespace QGst
diff --git a/src/QGst/event.h b/src/QGst/event.h
index ea3c06c..949e0c0 100644
--- a/src/QGst/event.h
+++ b/src/QGst/event.h
@@ -222,6 +222,12 @@ public:
bool intermediate() const;
};
+/*! \relates QGst::Event */
+QDebug operator<<(QDebug debug, EventType type);
+
+/*! \relates QGst::Event */
+QDebug operator<<(QDebug debug, const EventPtr & event);
+
} //namespace QGst
QGLIB_REGISTER_TYPE(QGst::Event)
@@ -238,10 +244,4 @@ QGST_REGISTER_SUBCLASS(Event, Navigation)
QGST_REGISTER_SUBCLASS(Event, Latency)
QGST_REGISTER_SUBCLASS(Event, Step)
-/*! \relates QGst::Event */
-QDebug operator<<(QDebug debug, QGst::EventType type);
-
-/*! \relates QGst::Event */
-QDebug operator<<(QDebug debug, const QGst::EventPtr & event);
-
#endif
diff --git a/src/QGst/message.cpp b/src/QGst/message.cpp
index 976dfdd..a754f3e 100644
--- a/src/QGst/message.cpp
+++ b/src/QGst/message.cpp
@@ -575,16 +575,16 @@ void QosMessage::setStats(Format format, quint64 processed, quint64 dropped)
dropped);
}
-} //namespace QGst
-
-QDebug operator<<(QDebug debug, QGst::MessageType type)
+QDebug operator<<(QDebug debug, MessageType type)
{
debug.nospace() << gst_message_type_get_name(static_cast<GstMessageType>(type));
return debug.space();
}
-QDebug operator<<(QDebug debug, const QGst::MessagePtr & message)
+QDebug operator<<(QDebug debug, const MessagePtr & message)
{
debug.nospace() << "QGst::Message(Type: " << message->type() << ")";
return debug.space();
}
+
+} //namespace QGst
diff --git a/src/QGst/message.h b/src/QGst/message.h
index d149221..44ee0e7 100644
--- a/src/QGst/message.h
+++ b/src/QGst/message.h
@@ -317,6 +317,12 @@ public:
void setStats(Format format, quint64 processed, quint64 dropped);
};
+/*! \relates QGst::Message */
+QDebug operator<<(QDebug debug, MessageType type);
+
+/*! \relates QGst::Message */
+QDebug operator<<(QDebug debug, const MessagePtr & message);
+
} //namespace QGst
QGLIB_REGISTER_TYPE(QGst::Message)
@@ -338,10 +344,4 @@ QGST_REGISTER_SUBCLASS(Message, RequestState)
QGST_REGISTER_SUBCLASS(Message, StepStart)
QGST_REGISTER_SUBCLASS(Message, Qos)
-/*! \relates QGst::Message */
-QDebug operator<<(QDebug debug, QGst::MessageType type);
-
-/*! \relates QGst::Message */
-QDebug operator<<(QDebug debug, const QGst::MessagePtr & message);
-
#endif
diff --git a/src/QGst/query.cpp b/src/QGst/query.cpp
index c108198..0ca7378 100644
--- a/src/QGst/query.cpp
+++ b/src/QGst/query.cpp
@@ -405,17 +405,16 @@ void UriQuery::setValue(const QUrl & uri)
//********************************************************
-} //namespace QGst
-
-QDebug operator<<(QDebug debug, QGst::QueryType type)
+QDebug operator<<(QDebug debug, QueryType type)
{
debug.nospace() << gst_query_type_get_name(static_cast<GstQueryType>(type));
return debug.space();
}
-QDebug operator<<(QDebug debug, const QGst::QueryPtr & query)
+QDebug operator<<(QDebug debug, const QueryPtr & query)
{
debug.nospace() << "QGst::Query(Type: " << query->type() << ")";
return debug.space();
}
+} //namespace QGst
diff --git a/src/QGst/query.h b/src/QGst/query.h
index 78d56eb..ecc4397 100644
--- a/src/QGst/query.h
+++ b/src/QGst/query.h
@@ -214,6 +214,12 @@ public:
void setValue(const QUrl & uri);
};
+/*! \relates QGst::Query */
+QDebug operator<<(QDebug debug, QueryType type);
+
+/*! \relates QGst::Query */
+QDebug operator<<(QDebug debug, const QueryPtr & query);
+
} //namespace QGst
QGLIB_REGISTER_TYPE(QGst::Query)
@@ -227,10 +233,4 @@ QGST_REGISTER_SUBCLASS(Query, Formats)
QGST_REGISTER_SUBCLASS(Query, Buffering)
QGST_REGISTER_SUBCLASS(Query, Uri)
-/*! \relates QGst::Query */
-QDebug operator<<(QDebug debug, QGst::QueryType type);
-
-/*! \relates QGst::Query */
-QDebug operator<<(QDebug debug, const QGst::QueryPtr & query);
-
#endif
diff --git a/src/QGst/structure.cpp b/src/QGst/structure.cpp
index e969db3..4534879 100644
--- a/src/QGst/structure.cpp
+++ b/src/QGst/structure.cpp
@@ -169,9 +169,7 @@ SharedStructure::~SharedStructure()
//END SharedStructure
-} //namespace QGst
-
-QDebug operator<<(QDebug debug, const QGst::Structure & structure)
+QDebug operator<<(QDebug debug, const Structure & structure)
{
debug.nospace() << "QGst::StructureBase";
if (structure.isValid()) {
@@ -181,3 +179,5 @@ QDebug operator<<(QDebug debug, const QGst::Structure & structure)
}
return debug.space();
}
+
+} //namespace QGst
diff --git a/src/QGst/structure.h b/src/QGst/structure.h
index 89b7356..6d3f111 100644
--- a/src/QGst/structure.h
+++ b/src/QGst/structure.h
@@ -106,10 +106,10 @@ private:
};
-} //namespace QGst
-
/*! \relates QGst::StructureBase */
-QDebug operator<<(QDebug debug, const QGst::Structure & structure);
+QDebug operator<<(QDebug debug, const Structure & structure);
+
+} //namespace QGst
QGLIB_REGISTER_TYPE(QGst::Structure)
QGLIB_REGISTER_TYPE(QGst::SharedStructure) //codegen: GType=GST_TYPE_STRUCTURE