瀏覽代碼

Even more naming conventions

Ole Krüger 10 年之前
父節點
當前提交
1902052d4d
共有 6 個文件被更改,包括 16 次插入16 次删除
  1. 1 1
      README.md
  2. 1 1
      examples/stack.cpp
  3. 1 1
      examples/types.cpp
  4. 2 2
      lib/luwra/functions.hpp
  5. 10 10
      lib/luwra/stack.hpp
  6. 1 1
      lib/luwra/usertypes.hpp

+ 1 - 1
README.md

@@ -63,7 +63,7 @@ lua_Number foo(lua_Number a, lua_Number b, lua_Number c);
 Simply apply the function:
 
 ```c++
-lua_Integer result = apply(lua_state, foo);
+lua_Integer result = Apply(lua_state, foo);
 ```
 
 The above statement is equivalent to

+ 1 - 1
examples/stack.cpp

@@ -26,7 +26,7 @@ int main() {
 
 	// ... which is a little cumbersome. Instead we might apply a fitting function to our stack.
 	std::cout << "(a + b) * c = "
-	          << apply(state, sum3)
+	          << Apply(state, sum3)
 	          << std::endl;
 
 	lua_close(state);

+ 1 - 1
examples/types.cpp

@@ -50,7 +50,7 @@ int main() {
 	Value<char>::Push(state, 'i');
 
 	// Apply function to stack values
-	apply(state, read_chars);
+	Apply(state, read_chars);
 
 	lua_close(state);
 	return 0;

+ 2 - 2
lib/luwra/functions.hpp

@@ -43,7 +43,7 @@ namespace internal {
 	struct FunctionWrapper<void(A...)> {
 		template <void (*FunctionPointer)(A...)> static
 		int Invoke(State* state) {
-			apply(state, FunctionPointer);
+			Apply(state, FunctionPointer);
 			return 0;
 		}
 	};
@@ -54,7 +54,7 @@ namespace internal {
 		int Invoke(State* state) {
 			return Value<R>::Push(
 				state,
-				apply(state, FunctionPointer)
+				Apply(state, FunctionPointer)
 			);
 		}
 	};

+ 10 - 10
lib/luwra/stack.hpp

@@ -59,7 +59,7 @@ namespace internal {
  * Given a function `R f(A0, A1, ... An)` you are able to map over
  * the values on the stack on the stack like so:
  *
- *   R my_result = apply(lua_state, pos, f);
+ *   R my_result = Apply(lua_state, pos, f);
  *
  * which is equivalent to
  *
@@ -68,32 +68,32 @@ namespace internal {
  * where x0, x1, ... xn are the values on the stack.
  */
 template <typename R, typename... A> static inline
-R apply(State* state, int pos, R (*funptr)(A...)) {
+R Apply(State* state, int pos, R (*funptr)(A...)) {
 	return internal::Layout<R(A...)>::Direct(state, pos, funptr);
 }
 
 /**
- * Same as `apply(state, 1, funptr)`.
+ * Same as `Apply(state, 1, funptr)`.
  */
 template <typename R, typename... A> static inline
-R apply(State* state, R (*funptr)(A...)) {
-	return apply(state, 1, funptr);
+R Apply(State* state, R (*funptr)(A...)) {
+	return Apply(state, 1, funptr);
 }
 
 /**
- * Specialization of `apply` which works for `std::function`.
+ * Specialization of `Apply` which works for `std::function`.
  */
 template <typename R, typename... A> static inline
-R apply(State* state, int pos, std::function<R(A...)> fun) {
+R Apply(State* state, int pos, std::function<R(A...)> fun) {
 	return internal::Layout<R(A...)>::Direct(state, pos, fun);
 }
 
 /**
- * Same as `apply(state, 1, fun)`.
+ * Same as `Apply(state, 1, fun)`.
  */
 template <typename R, typename... A> static inline
-R apply(State* state, std::function<R(A...)> fun) {
-	return apply(state, 1, fun);
+R Apply(State* state, std::function<R(A...)> fun) {
+	return Apply(state, 1, fun);
 }
 
 LUWRA_NS_END

+ 1 - 1
lib/luwra/usertypes.hpp

@@ -27,7 +27,7 @@ namespace internal {
 
 	template <typename T, typename... A>
 	int UserTypeConstructor(State* state) {
-		return apply(state, std::function<int(A...)>([state](A... args) {
+		return Apply(state, std::function<int(A...)>([state](A... args) {
 			return Value<T&>::Push(state, args...);
 		}));
 	}