1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2025-07-15 13:29:45 +02:00

mimgrating from another repo

This commit is contained in:
Xuan Sang LE
2018-09-19 15:08:49 +02:00
parent 91320521e8
commit 38bd13b46b
600 changed files with 362490 additions and 1 deletions

View File

@ -0,0 +1,45 @@
###############################################################################
#
# Package: NaturalDocs::ImageReferenceTable::Reference
#
###############################################################################
#
# A class for references being tracked in <NaturalDocs::SourceDB>.
#
###############################################################################
# This file is part of Natural Docs, which is Copyright <20> 2003-2010 Greg Valure
# Natural Docs is licensed under version 3 of the GNU Affero General Public License (AGPL)
# Refer to License.txt for the complete details
use strict;
use integer;
package NaturalDocs::ImageReferenceTable::Reference;
use base 'NaturalDocs::SourceDB::Item';
use NaturalDocs::DefineMembers 'TARGET', 'Target()', 'SetTarget()',
'NEEDS_REBUILD', 'NeedsRebuild()', 'SetNeedsRebuild()';
#
# Variables: Members
#
# The following constants are indexes into the object array.
#
# TARGET - The image <FileName> this reference resolves to, or undef if none.
#
#
# Functions: Member Functions
#
# Target - Returns the image <FileName> this reference resolves to, or undef if none.
# SetTarget - Replaces the image <FileName> this reference resolves to, or undef if none.
#
1;

View File

@ -0,0 +1,111 @@
###############################################################################
#
# Package: NaturalDocs::ImageReferenceTable::String
#
###############################################################################
#
# A package for creating and managing <ImageReferenceStrings>.
#
###############################################################################
# This file is part of Natural Docs, which is Copyright <20> 2003-2010 Greg Valure
# Natural Docs is licensed under version 3 of the GNU Affero General Public License (AGPL)
# Refer to License.txt for the complete details
use strict;
use integer;
package NaturalDocs::ImageReferenceTable::String;
#
# Type: ImageReferenceString
#
# A string representing a unique image reference. It's composed of the reference text and the directory of the source file.
# The source file name itself isn't included because two files in the same directory with the same reference text will always go
# to the same targets.
#
#
# Function: Make
#
# Converts a source <FileName> and the reference text to an <ImageReferenceString>.
#
sub Make #(FileName sourceFile, string text) => ImageReferenceString
{
my ($self, $sourceFile, $text) = @_;
my $path = NaturalDocs::File->NoFileName($sourceFile);
# Condense whitespace and remove any separator characters.
$path =~ tr/ \t\r\n\x1C/ /s;
$text =~ tr/ \t\r\n\x1C/ /s;
return $path . "\x1C" . $text;
};
#
# Function: InformationOf
#
# Returns the information contained in the <ImageReferenceString> as the array ( path, text ).
#
sub InformationOf #(ImageReferenceString referenceString)
{
my ($self, $referenceString) = @_;
return split(/\x1C/, $referenceString);
};
#
# Function: ToBinaryFile
#
# Writes an <ImageReferenceString> to <NaturalDocs::BinaryFile>. Can also encode an undef.
#
# Format:
#
# > [UString16: path] [UString16: reference text] ...
#
# Undef is represented by the first UString16 being undef.
#
sub ToBinaryFile #(ImageReferenceString referenceString)
{
my ($self, $referenceString) = @_;
if (defined $referenceString)
{
my ($path, $text) = split(/\x1C/, $referenceString);
NaturalDocs::BinaryFile->WriteUString16($path);
NaturalDocs::BinaryFile->WriteUString16($text);
}
else
{
NaturalDocs::BinaryFile->WriteUString16(undef);
};
};
#
# Function: FromBinaryFile
#
# Loads an <ImageReferenceString> or undef from <NaturalDocs::BinaryFile> and returns it.
#
sub FromBinaryFile
{
my $self = shift;
my $path = NaturalDocs::BinaryFile->GetUString16();
if (!defined $path)
{ return undef; };
my $text = NaturalDocs::BinaryFile->GetUString16();
return $path . "\x1C" . $text;
};
1;