class AdLint::Cc1::PrintfFormat::Directive

DESCRIPTION

Directive class hierarchy

Directive
  <-- Ordinary
  <-- ConversionSpecifier
        <-- CompleteConversionSpecifier
              <-- NumberConversionSpecifier
                    <-- Conversion_d
                          <-- Conversion_i
                          <-- Conversion_o
                                <-- Conversion_u
                                <-- Conversion_x
                                <-- Conversion_X
                    <-- Conversion_f
                          <-- Conversion_F
                          <-- Conversion_e
                          <-- Conversion_E
                          <-- Conversion_g
                          <-- Conversion_G
                          <-- Conversion_a
                          <-- Conversion_A
                    <-- Conversion_p
              <-- CharacterConversionSpecifier
                    <-- Conversion_c
              <-- StringConversionSpecifier
                    <-- Conversion_s
              <-- Conversion_n
              <-- Conversion_percent
              <-- UndefinedConversionSpecifier
        <-- IncompleteConversionSpecifier

Attributes

format[R]

Public Class Methods

guess(fmt_str, trailing_args, env) click to toggle source
# File lib/adlint/cc1/format.rb, line 101
def self.guess(fmt_str, trailing_args, env)
  try_to_create_ordinary(fmt_str) or
  try_to_create_conversion_specifier(fmt_str, trailing_args, env)
end
new(fmt, consume_args) click to toggle source
# File lib/adlint/cc1/format.rb, line 106
def initialize(fmt, consume_args)
  @format = fmt
  @consume_arguments = consume_args
end

Private Class Methods

try_to_create_conversion_specifier(fmt_str, trailing_args, env) click to toggle source
# File lib/adlint/cc1/format.rb, line 213
def self.try_to_create_conversion_specifier(fmt_str, trailing_args, env)
  fmt, flags, field_width, prec, len_mod, cs_char =
    ConversionSpecifier.scan(fmt_str)

  case
  when cs_char.nil?
    IncompleteConversionSpecifier.new(fmt, flags, field_width, prec,
                                      len_mod)
  when cs_class = CONVERSION_SPECIFIER_TBL[cs_char]
    cs_class.new(fmt, trailing_args, env, flags, field_width, prec,
                 len_mod, cs_char)
  else
    UndefinedConversionSpecifier.new(fmt, flags, field_width, prec,
                                     len_mod, cs_char)
  end
end
try_to_create_ordinary(fmt_str) click to toggle source
# File lib/adlint/cc1/format.rb, line 208
def self.try_to_create_ordinary(fmt_str)
  (fmt = Ordinary.scan(fmt_str)) ? Ordinary.new(fmt) : nil
end

Public Instance Methods

acceptable?() click to toggle source

DESCRIPTION

Checks whether types of arguments match this directive.

RETURN VALUE

Boolean – True if types of arguments match this directive.

# File lib/adlint/cc1/format.rb, line 130
def acceptable?
  subclass_responsibility
end
complete?() click to toggle source
# File lib/adlint/cc1/format.rb, line 148
def complete?
  subclass_responsibility
end
consume_arguments?() click to toggle source
# File lib/adlint/cc1/format.rb, line 121
def consume_arguments?
  @consume_arguments
end
conversion_specifier?() click to toggle source
# File lib/adlint/cc1/format.rb, line 117
def conversion_specifier?
  subclass_responsibility
end
conversion_specifier_character() click to toggle source
# File lib/adlint/cc1/format.rb, line 204
def conversion_specifier_character
  subclass_responsibility
end
field_width() click to toggle source
# File lib/adlint/cc1/format.rb, line 192
def field_width
  subclass_responsibility
end
flags() click to toggle source
# File lib/adlint/cc1/format.rb, line 188
def flags
  subclass_responsibility
end
illformed?() click to toggle source
# File lib/adlint/cc1/format.rb, line 144
def illformed?
  !wellformed?
end
incomplete?() click to toggle source
# File lib/adlint/cc1/format.rb, line 152
def incomplete?
  !complete?
end
length_modifier() click to toggle source
# File lib/adlint/cc1/format.rb, line 200
def length_modifier
  subclass_responsibility
end
max_length() click to toggle source
# File lib/adlint/cc1/format.rb, line 184
def max_length
  subclass_responsibility
end
min_length() click to toggle source
# File lib/adlint/cc1/format.rb, line 180
def min_length
  subclass_responsibility
end
ordinary?() click to toggle source
# File lib/adlint/cc1/format.rb, line 113
def ordinary?
  !conversion_specifier?
end
precision() click to toggle source
# File lib/adlint/cc1/format.rb, line 196
def precision
  subclass_responsibility
end
undefined?() click to toggle source
# File lib/adlint/cc1/format.rb, line 156
def undefined?
  subclass_responsibility
end
valid_conversion_specifier_character?() click to toggle source
# File lib/adlint/cc1/format.rb, line 176
def valid_conversion_specifier_character?
  subclass_responsibility
end
valid_field_width?() click to toggle source
# File lib/adlint/cc1/format.rb, line 164
def valid_field_width?
  subclass_responsibility
end
valid_flags?() click to toggle source
# File lib/adlint/cc1/format.rb, line 160
def valid_flags?
  subclass_responsibility
end
valid_length_modifier?() click to toggle source
# File lib/adlint/cc1/format.rb, line 172
def valid_length_modifier?
  subclass_responsibility
end
valid_precision?() click to toggle source
# File lib/adlint/cc1/format.rb, line 168
def valid_precision?
  subclass_responsibility
end
wellformed?() click to toggle source

DESCRIPTION

Checks whether the format string of this directive is the ISO C99 compliant.

RETURN VALUE

Boolean – True if the format string is wellformed.

# File lib/adlint/cc1/format.rb, line 140
def wellformed?
  subclass_responsibility
end