1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

clipboard: document all pub functions, adhere to vdoc style (#8243)

This commit is contained in:
Larpon
2021-01-21 12:45:59 +01:00
committed by GitHub
parent 59c3e98c16
commit 62c2168b0b
7 changed files with 53 additions and 28 deletions

View File

@@ -1,36 +1,37 @@
module clipboard
// create a new clipboard
// new returns a new `Clipboard` instance allocated on the heap.
// The `Clipboard` resources can be released with `free()`
pub fn new() &Clipboard {
return new_clipboard()
}
// copy some text into the clipboard
// copy copies `text` into the clipboard.
pub fn (mut cb Clipboard) copy(text string) bool {
return cb.set_text(text)
}
// get the text from the clipboard
// paste returns current entry as a `string` from the clipboard.
pub fn (mut cb Clipboard) paste() string {
return cb.get_text()
}
// clear the clipboard
// clear_all clears the clipboard.
pub fn (mut cb Clipboard) clear_all() {
cb.clear()
}
// destroy the clipboard
// destroy destroys the clipboard and free it's resources.
pub fn (mut cb Clipboard) destroy() {
cb.free()
}
// check if we own the clipboard
// check_ownership returns `true` if the `Clipboard` has the content ownership.
pub fn (cb Clipboard) check_ownership() bool {
return cb.has_ownership()
}
// check if clipboard can be used
// is_available returns `true` if the clipboard is available for use.
pub fn (cb &Clipboard) is_available() bool {
return cb.check_availability()
}