Commits

Anonymous committed 7545b28

Start working on some code for checking QVariants

  • Participants
  • Parent commits 2264bec

Comments (0)

Files changed (3)

src/neovimconnector.cpp

 		msgpack_pack_int64(&m_pk, var.toPoint().y());
 		msgpack_pack_int64(&m_pk, var.toPoint().x());
 	default:
-		// FIXME: This should not be possible - write checkVariant() was used
 		msgpack_pack_nil(&m_pk);
 		qWarning() << "Trying to pack unsupported variant type" << var.type() << "packing Nil instead";
 	}
 #include "util.h"
 
+namespace NeoVimQt {
+
+/**
+ * Some NeoVim functions take arguments of type **Object** which works an
+ * abstract container for various data types - In this lib we use QVariant
+ * for this purpose
+ *
+ * The problem being that QVariant can encapsulate some data types that cannot
+ * be serialised at as msgpack data, or just would not make sense for NeoVim to
+ * handle.
+ *
+ * Ideally we would detect such errors early on and avoid sending those objects
+ * entirely - this function checks if QVariant objects are admissible
+ */
+bool checkVariant(const QVariant& )
+{
+	// FIXME: implement my please :D
+	return true;
+}
+} // namespace
+
 /**
  * Overload to use msgpack_object with qDebug()
  *
 QDebug operator<<(QDebug dbg, const msgpack_object&);
 QDebug operator<<(QDebug dbg, const NeoVimQt::Function& f);
 
+namespace NeoVimQt {
+bool checkVariant(const QVariant&);
+};
+
 #endif