Audio-TagLib

 view release on metacpan or  search on metacpan

lib/Audio/TagLib/String.pm  view on Meta::CPAN

=pod

=begin stopwords

Dongxu

=end stopwords

=head1 NAME

Audio::TagLib::String - A wide string class suitable for unicode

=head1 SYNOPSIS

  use Audio::TagLib::String;
  
  my $i = Audio::TagLib::String->new("blah blah blah");
  print $i->toCString(), "\n"; # got "blah blah blah"

=head1 DESCRIPTION

lib/Audio/TagLib/String.pm  view on Meta::CPAN


Constructs a String from the data $data. 

B<NOTE> $data should be the internal format of Perl. It will check the
UTF8 to determine the encode to use(Latin1 or UTF8 in this case).

=item I<DESTROY()>

Destroys this String instance.

=item I<PV to8Bit(BOOL $unicode = FALSE)>

If $unicode is false (the default) this will return a Latin1 encoded
string. If it is true the returned string will be UTF-8 encoded and
UTF8 flag on.

=item I<PV toCString(BOOL $unicode = FALSE)>

see I<to8Bit()>

B<WARNING> Differ from C/C++, the PV will contain a copy of the string
returned by C/C++ code.

=item I<L<Iterator|Audio::TagLib::String::Iterator> begin()>

Returns an iterator pointing to the beginning of the string.

ppport.h  view on Meta::CPAN

pad_new|||
pad_peg|||n
pad_push|||
pad_reset|||
pad_setsv|||
pad_sv||5.011000|
pad_swipe|||
pad_tidy|||
pad_undef|||
parse_body|||
parse_unicode_opts|||
parser_dup|||
parser_free|||
path_is_absolute|||n
peep|||
pending_Slabs_to_ro|||
perl_alloc_using|||n
perl_alloc|||n
perl_clone_using|||n
perl_clone|||n
perl_construct|||n

ppport.h  view on Meta::CPAN

#endif
#ifndef PERL_PV_PRETTY_DUMP
#  define PERL_PV_PRETTY_DUMP            PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE
#endif

#ifndef PERL_PV_PRETTY_REGPROP
#  define PERL_PV_PRETTY_REGPROP         PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE
#endif

/* Hint: pv_escape
 * Note that unicode functionality is only backported to
 * those perl versions that support it. For older perl
 * versions, the implementation will fall back to bytes.
 */

#ifndef pv_escape
#if defined(NEED_pv_escape)
static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags);
static
#else
extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags);

xs/tstring.xs  view on Meta::CPAN


void
TagLib::String::DESTROY()
CODE:
	/* skip TagLib::String::null */
	if(THIS != &(TagLib::String::null) && !SvREADONLY(SvRV(ST(0))))
		delete THIS;

################################################################
# 
# std::string to8Bit(bool unicode=false) const
# 
# return a PV instead
# set UTF8 flag accordingly
# 
################################################################
SV * 
TagLib::String::to8Bit(unicode = false)
	bool unicode
INIT:
	std::string string = THIS->to8Bit(unicode);
CODE:
	RETVAL = newSVpv(string.c_str(), 0);
#ifdef PERLV_LESS_12
	if(sv_len_utf8(RETVAL) != sv_len(RETVAL))
#else
    if(!is_ascii_string((const U8 *)string.c_str(), 0)) /* RT 85621 */
#endif
		SvUTF8_on(RETVAL);
OUTPUT:
	RETVAL

SV * 
TagLib::String::toCString(unicode = false) 
	bool unicode
INIT:
	const char *c_str = THIS->toCString(unicode);
CODE:
	RETVAL = newSVpv(c_str, 0);
#ifdef PERLV_LESS_12
	if(sv_len_utf8(RETVAL) != sv_len(RETVAL))
#else
    if(!is_ascii_string((const U8 *)c_str,0)) /* RT 85621 */
#endif
		SvUTF8_on(RETVAL);
OUTPUT:
	RETVAL



( run in 1.356 second using v1.01-cache-2.11-cpan-39bf76dae61 )