Explorar el Código

docs: Add some missing documentation

Ole hace 10 años
padre
commit
133911e7fa
Se han modificado 3 ficheros con 32 adiciones y 10 borrados
  1. 20 2
      lib/luwra/auxiliary.hpp
  2. 1 1
      lib/luwra/state.hpp
  3. 11 7
      lib/luwra/types.hpp

+ 20 - 2
lib/luwra/auxiliary.hpp

@@ -17,6 +17,9 @@ LUWRA_NS_BEGIN
 
 /**
  * Check if two values are equal.
+ * \param state  Lua state
+ * \param index1 Index of left-hand side value
+ * \param index2 Index of right-hand side value
  */
 static inline
 bool equal(State* state, int index1, int index2) {
@@ -29,6 +32,9 @@ bool equal(State* state, int index1, int index2) {
 
 /**
  * Register a value as a global.
+ * \param state Lua state
+ * \param name  Global name
+ * \param value Global value
  */
 template <typename V> static inline
 void setGlobal(State* state, const std::string& name, V value) {
@@ -38,6 +44,9 @@ void setGlobal(State* state, const std::string& name, V value) {
 
 /**
  * Retrieve a global value.
+ * \param state Lua state
+ * \param name  Global name
+ * \returns Value associated with the given name
  */
 template <typename V> static inline
 V getGlobal(State* state, const std::string& name) {
@@ -72,6 +81,9 @@ namespace internal {
 
 /**
  * Set multiple fields at once. Allows you to provide multiple key-value pairs.
+ * \param state Lua state
+ * \param index Table index
+ * \param args  Key-value pairs
  */
 template <typename... R> static inline
 void setFields(State* state, int index, R&&... args) {
@@ -80,12 +92,15 @@ void setFields(State* state, int index, R&&... args) {
 }
 
 /**
- *
+ * A collection of key-value pairs.
  */
 using FieldVector = std::vector<std::pair<Pushable, Pushable>>;
 
 /**
- *
+ * Apply key-value pairs to a table.
+ * \param state  Lua state
+ * \param index  Table index
+ * \param fields Table fields
  */
 static inline
 void setFields(State* state, int index, const FieldVector& fields) {
@@ -101,6 +116,9 @@ void setFields(State* state, int index, const FieldVector& fields) {
 
 template <>
 struct Value<FieldVector> {
+	/**
+	 * Pushing a FieldVector will create a new table with the given fields.
+	 */
 	static inline
 	size_t push(State* state, const FieldVector& fields) {
 		lua_newtable(state);

+ 1 - 1
lib/luwra/state.hpp

@@ -119,7 +119,7 @@ struct StateWrapper {
 	}
 
 	/**
-	 * \todo Document me
+	 * See [luwra::registerUserType](@ref luwra::registerUserType).
 	 */
 	template <typename T> inline
 	void registerUserType(

+ 11 - 7
lib/luwra/types.hpp

@@ -301,10 +301,20 @@ struct Value<CFunction> {
  * Note: this value is only available as long as it exists on its originating stack.
  */
 struct Arbitrary {
+	/**
+	 * Originating Lua state
+	 */
 	State* state;
+
+	/**
+	 * Stack index
+	 */
 	int index;
 };
 
+/**
+ * See [Arbitrary](@ref Arbitrary).
+ */
 template <>
 struct Value<Arbitrary> {
 	static inline
@@ -374,9 +384,6 @@ template <typename T>
 struct Value<volatile T>: Value<T> {};
 
 namespace internal {
-	/**
-	 *
-	 */
 	struct PushableI {
 		virtual
 		size_t push(State* state) const = 0;
@@ -388,9 +395,6 @@ namespace internal {
 		~PushableI() {}
 	};
 
-	/**
-	 *
-	 */
 	template <typename T>
 	struct PushableT: virtual PushableI {
 		T value;
@@ -411,7 +415,7 @@ namespace internal {
 }
 
 /**
- *
+ * A value which may be pushed onto the stack.
  */
 struct Pushable: virtual internal::PushableI {
 	internal::PushableI* interface;