diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cross_calculator/nim_commandline/nimcalculator.nim | 2 | ||||
-rw-r--r-- | examples/cross_todo/nim_backend/backend.nim | 18 | ||||
-rw-r--r-- | examples/cross_todo/nim_backend/testbackend.nim | 2 | ||||
-rw-r--r-- | examples/cross_todo/nim_commandline/nimtodo.nim | 16 | ||||
-rw-r--r-- | examples/talk/dsl.nim | 2 |
5 files changed, 20 insertions, 20 deletions
diff --git a/examples/cross_calculator/nim_commandline/nimcalculator.nim b/examples/cross_calculator/nim_commandline/nimcalculator.nim index 69d62a90c..3f7674dbb 100644 --- a/examples/cross_calculator/nim_commandline/nimcalculator.nim +++ b/examples/cross_calculator/nim_commandline/nimcalculator.nim @@ -3,7 +3,7 @@ import backend, parseopt, strutils const - USAGE = """nimcalculator - Nimrod cross platform calculator + USAGE = """nimcalculator - Nim cross platform calculator (beta version, only integer addition is supported!) Usage: diff --git a/examples/cross_todo/nim_backend/backend.nim b/examples/cross_todo/nim_backend/backend.nim index 5b49bc4a9..6869665f8 100644 --- a/examples/cross_todo/nim_backend/backend.nim +++ b/examples/cross_todo/nim_backend/backend.nim @@ -1,6 +1,6 @@ # Backend for a simple todo program with sqlite persistence. # -# Most procs dealing with a TDbConn object may raise an EDb exception. +# Most procs dealing with a DbConn object may raise an EDb exception. import db_sqlite, parseutils, strutils, times @@ -42,7 +42,7 @@ proc initDefaults*(params: var TPagedParams) = params.showChecked = false -proc openDatabase*(path: string): TDbConn = +proc openDatabase*(path: string): DbConn = ## Creates or opens the sqlite3 database. ## ## Pass the path to the sqlite database, if the database doesn't exist it @@ -86,7 +86,7 @@ proc getModificationDate*(todo: TTodo): Time = return todo.modificationDate -proc update*(todo: var TTodo; conn: TDbConn): bool = +proc update*(todo: var TTodo; conn: DbConn): bool = ## Checks the database for the object and refreshes its variables. ## ## Use this method if you (or another entity) have modified the database and @@ -112,7 +112,7 @@ proc update*(todo: var TTodo; conn: TDbConn): bool = echo("Something went wrong selecting for id " & $todo.id) -proc save*(todo: var TTodo; conn: TDbConn): bool = +proc save*(todo: var TTodo; conn: DbConn): bool = ## Saves the current state of text, priority and isDone to the database. ## ## Returns true if the database object was updated (in which case the @@ -135,7 +135,7 @@ proc save*(todo: var TTodo; conn: TDbConn): bool = # - Procs dealing directly with the database # -proc addTodo*(conn: TDbConn; priority: int; text: string): TTodo = +proc addTodo*(conn: DbConn; priority: int; text: string): TTodo = ## Inserts a new todo into the database. ## ## Returns the generated todo object. If there is an error EDb will be raised. @@ -149,7 +149,7 @@ proc addTodo*(conn: TDbConn; priority: int; text: string): TTodo = result = initFromDB(todoId, text, priority, false, currentDate) -proc deleteTodo*(conn: TDbConn; todoId: int64): int64 {.discardable.} = +proc deleteTodo*(conn: DbConn; todoId: int64): int64 {.discardable.} = ## Deletes the specified todo identifier. ## ## Returns the number of rows which were affected (1 or 0) @@ -157,7 +157,7 @@ proc deleteTodo*(conn: TDbConn; todoId: int64): int64 {.discardable.} = result = conn.execAffectedRows(query, $todoId) -proc getNumEntries*(conn: TDbConn): int = +proc getNumEntries*(conn: DbConn): int = ## Returns the number of entries in the Todos table. ## ## If the function succeeds, returns the zero or positive value, if something @@ -171,7 +171,7 @@ proc getNumEntries*(conn: TDbConn): int = result = -1 -proc getPagedTodos*(conn: TDbConn; params: TPagedParams; +proc getPagedTodos*(conn: DbConn; params: TPagedParams; page = 0'i64): seq[TTodo] = ## Returns the todo entries for a specific page. ## @@ -210,7 +210,7 @@ proc getPagedTodos*(conn: TDbConn; params: TPagedParams; row[3].parseBool, Time(row[4].parseInt))) -proc getTodo*(conn: TDbConn; todoId: int64): ref TTodo = +proc getTodo*(conn: DbConn; todoId: int64): ref TTodo = ## Returns a reference to a TTodo or nil if the todo could not be found. var tempTodo: TTodo tempTodo.id = todoId diff --git a/examples/cross_todo/nim_backend/testbackend.nim b/examples/cross_todo/nim_backend/testbackend.nim index 131dda1cf..6754f013a 100644 --- a/examples/cross_todo/nim_backend/testbackend.nim +++ b/examples/cross_todo/nim_backend/testbackend.nim @@ -3,7 +3,7 @@ import backend, db_sqlite, strutils, times -proc showPagedResults(conn: TDbConn; params: TPagedParams) = +proc showPagedResults(conn: DbConn; params: TPagedParams) = ## Shows the contents of the database in pages of specified size. ## ## Hmm... I guess this is more of a debug proc which should be moved outside, diff --git a/examples/cross_todo/nim_commandline/nimtodo.nim b/examples/cross_todo/nim_commandline/nimtodo.nim index 4ab17e7a2..c8993b2c8 100644 --- a/examples/cross_todo/nim_commandline/nimtodo.nim +++ b/examples/cross_todo/nim_commandline/nimtodo.nim @@ -3,7 +3,7 @@ import backend, db_sqlite, os, parseopt, parseutils, strutils, times const - USAGE = """nimtodo - Nimrod cross platform todo manager + USAGE = """nimtodo - Nim cross platform todo manager Usage: nimtodo [command] [list options] @@ -191,11 +191,11 @@ proc parseCmdLine(): TParamConfig = abort("Used list options, but didn't specify the list command.", 10) -proc generateDatabaseRows(conn: TDbConn) = +proc generateDatabaseRows(conn: DbConn) = ## Adds some rows to the database ignoring errors. discard conn.addTodo(1, "Watch another random youtube video") discard conn.addTodo(2, "Train some starcraft moves for the league") - discard conn.addTodo(3, "Spread the word about Nimrod") + discard conn.addTodo(3, "Spread the word about Nim") discard conn.addTodo(4, "Give fruit superavit to neighbours") var todo = conn.addTodo(4, "Send tax form through snail mail") todo.isDone = true @@ -209,7 +209,7 @@ proc generateDatabaseRows(conn: TDbConn) = echo("Generated some entries, they were added to your database.") -proc listDatabaseContents(conn: TDbConn; listParams: TPagedParams) = +proc listDatabaseContents(conn: DbConn; listParams: TPagedParams) = ## Dumps the database contents formatted to the standard output. ## ## Pass the list/filter parameters parsed from the commandline. @@ -239,7 +239,7 @@ proc listDatabaseContents(conn: TDbConn; listParams: TPagedParams) = todo.text]) -proc deleteOneTodo(conn: TDbConn; todoId: int64) = +proc deleteOneTodo(conn: DbConn; todoId: int64) = ## Deletes a single todo entry from the database. let numDeleted = conn.deleteTodo(todoId) if numDeleted > 0: @@ -248,7 +248,7 @@ proc deleteOneTodo(conn: TDbConn; todoId: int64) = quit("Couldn't delete todo id " & $todoId, 11) -proc deleteAllTodos(conn: TDbConn) = +proc deleteAllTodos(conn: DbConn) = ## Deletes all the contents from the database. ## ## Note that it would be more optimal to issue a direct DELETE sql statement @@ -273,7 +273,7 @@ proc deleteAllTodos(conn: TDbConn) = echo("Deleted $1 todo entries from database." % $counter) -proc setTodoCheck(conn: TDbConn; todoId: int64; value: bool) = +proc setTodoCheck(conn: DbConn; todoId: int64; value: bool) = ## Changes the check state of a todo entry to the specified value. let newState = if value: "checked" else: "unchecked" @@ -293,7 +293,7 @@ proc setTodoCheck(conn: TDbConn; todoId: int64; value: bool) = quit("Error updating todo id $1 to $2." % [$todoId, newState]) -proc addTodo(conn: TDbConn; priority: int; tokens: seq[string]) = +proc addTodo(conn: DbConn; priority: int; tokens: seq[string]) = ## Adds to the database a todo with the specified priority. ## ## The tokens are joined as a single string using the space character. The diff --git a/examples/talk/dsl.nim b/examples/talk/dsl.nim index 4dfab5cd7..1034c99d4 100644 --- a/examples/talk/dsl.nim +++ b/examples/talk/dsl.nim @@ -28,6 +28,6 @@ html mainPage: title "now look at this" body: ul: - li "Nimrod is quite capable" + li "Nim is quite capable" echo mainPage() |