assemble.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
-------------------------> GNU Sather - sourcefile <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute and/or modify it under the terms of the GNU Library General --
-- Public License (LGPL) as published by the Free Software Foundation; --
-- either version 2 of the license, or (at your option) any later version. --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details. --
-- The license text is also available from: Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
--------------> Please email comments to <bug-sather@gnu.org> <--------------
partial class ASSEMBLE_STR < $ANCHORED_FMT
partial class ASSEMBLE_STR < $ANCHORED_FMT is
-- This partial class provides generic routines for handling those
-- values which are an assemblage of culture-defined string components and
-- variable string components (eg name, address, etc)
-- Version 1.1 Mar 99. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 6 Oct 98 kh Original from ADDRESS_STR class
-- 26 Mar 99 kh Revised for V8 of text classes
private transliterate(
input : BINSTR,
lib : LIBCHARS
) : RUNES
pre (input.size > 0)
and ~void(lib)
post result.size > 0
is
-- This private routine uses the transliteration map in the class
-- component of the culture.
map : FMAP{STR,STR} := lib.culture.char_data.trans_table ;
loc_str : STR := map.get(STR::build(input,lib)) ;
return RUNES::create(loc_str,lib)
end ;
render(
component : RUNES,
romanize : BOOL
) : STR
pre (component.size > 0)
post true
is
-- This routine renders the given component string in the character
-- encoding of lib, if necessary converting the string into a transliterated
-- form (usually Romanised using Latin letters). See ISO/IEC 14652 4.2.2
if romanize then
return transliterate(component.binstr,component.index_lib).str
else
return component.str
end
end ;
as_runes(
component : RUNES,
romanize : BOOL
) : RUNES
pre (component.size > 0)
post true
is
-- This routine renders the given component string in the character
-- encoding of lib, if necessary converting the string into a transliterated
-- form (usually Romanised using Latin letters). See ISO/IEC 14652 4.2.2
if romanize then
return transliterate(component.binstr,component.index_lib)
else
return component
end
end ;
str : STR
pre ~void(self)
post result.size > 0
is
-- This routine returns a string representation using the default
-- representation and language of the components which are separated by
-- an asterisk. No line marks are included.
return str(LIBCHARS::default)
end ;
runes : RUNES
pre ~void(self)
post result.size > 0
is
-- This routine returns a string representation using the default
-- representation and language of the components which are separated by
-- an asterisk. No line marks are included.
return runes
end ;
fmt(
format : ANCHORED_DESCR,
lib : LIBCHARS
) : STR
pre ~void(self)
and (format.width > 0)
and ~void(lib)
and (lib.my_size = 1)
post ~void(result)
is
-- This routine returns a fully formatted address. It should be noted
-- that this may or may not contain line-marks, although it is more usually
-- likely to do so.
res : STR := str(lib) ;
if format.leading > format.width then
res := STR::create(format.filler.char,lib).repeat(
format.leading - res.size) + res
end ;
return res + STR::create(format.filler.char,lib).repeat(format.trailing)
end ;
fmt(
format : ANCHORED_DESCR
) : STR
pre ~void(self)
and (format.width > 0)
post ~void(result)
is
-- This routine embeds the default format representation into the
-- given format string.
return fmt(format,LIBCHARS::default)
end ;
fmt_runes(
format : ANCHORED_DESCR,
lib : LIBCHARS
) : RUNES
pre ~void(self)
and (format.width > 0)
and ~void(lib)
post ~void(result)
is
-- This routine returns a fully formatted address. It should be noted
-- that this may or may not contain line-marks, although it is more usually
-- likely to do so.
res : RUNES := runes ;
if format.leading > format.width then
res := RUNES::create(format.filler.rune).repeat(
format.leading - res.size) + res
end ;
return res + RUNES::create(format.filler.rune).repeat(format.trailing)
end ;
fmt_runes(
format : ANCHORED_DESCR
) : RUNES
pre ~void(self)
and (format.width > 0)
post ~void(result)
is
-- This routine embeds the default format representation into the
-- given format string.
return fmt_runes(format,LIBCHARS::default)
end ;
end ; -- ASSEMBLE_STR