NAME

Sword::Key - Sword keys may be used to lookup module entries

VERSION

version 0.102800

SYNOPSIS

  use Sword;

  my $library = Sword::Manager->new;

  my $module = $library->get_module('KJV');
  my $key = $module->create_key;

  $key->set_text('James 1:5');

  $module->set_key($key);

DESCRIPTION

This Perl module provides access to the SWKey class from the Sword Engine API.

This documentation should cover everything that you can do with it. If something is wrong or missing, please report a bug.

METHODS

clone

  my $new_key = $key->clone;

Clones the key to create a new identical key.

set_text

  $key->set_text($key_string);

Sets the key string text.

get_text

  my $key_string = $key->get_text;

Retrieve the key string text.

get_short_text

  my $key_string = $key->get_short_text;

Retrieve a shortened key string text.

get_range_text

  my $range_string = $key->get_range_text;

Retrieve teh key string range text.

compare

  my $comparison = $key->compare($other_key);

Performs a comparison between keys. Returns positive if $key is ahead of $other_key. Returns 0 if they are equal. Returns negative if $key is behind $other_key.

equals

  my $equals = $key->equals($other_key);

Returns true if the two keys refer to the same position.

increment

decrement

  $key->increment;
  $key->increment($steps);
  $key->decrement;
  $key->decrement($steps);

Use increment to select a key one or more steps forward of the current. Use decrement to select a key backward. If $steps is omitted, the increment/decrement defaults to 1.

top

bottom

  $key->top
  $key->bottom

These set the key to the beginning or end position, respectively.

These are analogous to:

  key->setPosition(TOP);
  key->setPosition(BOTTOM);

in the C++ API.

index

  my $index = $key->index;
  $key->index($new_index);

Retrieve the index into a module that this key represents.

SEE ALSO

Sowrd::Module

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.